Simon Perepelitsa
Simon Perepelitsa

Reputation: 20639

Rails 3 does not see my class in "lib" directory

I've placed the file rack_app.rb with simple Rack application in the lib directory:

class RackApp
  def call env
    [200, {}, 'Hello']
  end
end

Then I've added this route:

match 'rack' => RackApp

And when I try to launch the rails server I get the following error:

config/routes.rb:65: uninitialized constant RackApp (NameError)

Upvotes: 2

Views: 1518

Answers (2)

Sagar Ranglani
Sagar Ranglani

Reputation: 5691

Include require 'email_format_validator' in the model.

Upvotes: 0

shingara
shingara

Reputation: 46914

Rails 3 has no more autoloading by default. So you need require your file

require 'lib/rack_app.rb'

Or come back the autoloading in application.rb

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

Upvotes: 9

Related Questions