shane
shane

Reputation: 2101

Addressable gem is not 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 addressable is installed. What am I doing wrong?

Upvotes: 4

Views: 3262

Answers (1)

khustochka
khustochka

Reputation: 2386

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.

Upvotes: 8

Related Questions