0

This seems fairly trivial but is giving me hella grief!

I have a module in the lib folder.

require 'net/http'
module Weather

  def get_response
    NET::HTTP.get_response(URI.parse 'someURL').body
  end

end 

The controller.

class SunController < ApplicationController
include Weather

  def show  
    logger.debug get_response
  end
end 

config/Application.rb

config.autoload_paths += %W(#{config.root}/lib)

And I get this error

uninitialized constant Weather::NET

I know the module is loaded correctly. What am I doing wrong?

1
  • don't define lib explicitly in your autoload paths. It will be loaded when the application starts. Commented Mar 5, 2013 at 20:40

1 Answer 1

3

The class is Net::HTTP not NET::HTTP.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.