No addressable gem found

In my gemfile I have:

gem 'addressable' 

In search_controller.rb:

 uri = Addressable::URI.new uri.query_values = {:q => query} 

I get this error:

 NameError (uninitialized constant SearchController::Addressable): 

If i put

 require 'addressable/uri' 

on top of my controller, it works !!. I have already done "sudo bundle install" and it shows that the addressee is installed. What am I doing wrong?

+4
source share
1 answer

Looking at the address source of the gems, I see that it does not have lib/addressable.rb , which is the default file that rubygems or bundler requires when downloading the necessary gem. So it looks like it is specifically designed so that you explicitly require only the libraries you need.

+7
source

Source: https://habr.com/ru/post/1435080/


All Articles