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 addressable is installed. What am I doing wrong?
Looking at addressable gem source I see it has no lib/addressable.rb
which is default file which rubygems or bundler require when loading required gem. So it looks like it is designed this way on purpose - to make you explicitly require only the libraries you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With