I'm new to developing rails apps, so for the most part here, I've relied heavily only on the rails generate command to make scaffolds for the entire app. While every other part of my app works fine, this one raises an error right after being automatically generated.
the error is as follows:
NoMethodError in ConfigurationsController#index
undefined method `all' for ActiveSupport::Configurable::Configuration:Class
here is the code snippet that contains said no method call
def index
@configurations = Configuration.all
end
and here is the said model in question
class Configuration < ActiveRecord::Base
belongs_to :users, class_name: 'User', foreign_key: 'user_id'
end
I added the belongs_to part... anyway, when I ran it through http://localhost.localhost:3000/users/1/configurations/ that error pops up! (yes, I used nested routes)
So i hit the rails console to check what Configuration.all returns and lo and behold
2.0.0-p247 :004 > Configuration.all
Configuration Load (0.3ms) SELECT "configurations".* FROM "configurations"
=> #<ActiveRecord::Relation [#<Configuration id: 1, user_id: 1, port: 3000, host: "example.org", annoy: 5000, version: "1", machines: nil, created_at: "2013-08-08 02:15:32", updated_at: "2013-08-08 02:15:32">]>
I'm kind of lost as to why that method works in rails console then fails in the html view on my browser. Did i do something wrong?
also, here is the output on webrick in case someone looks for it
Started GET "/users/1/configurations/" for 192.168.1.105 at 2013-08-08 10:24:59 +0800
Processing by ConfigurationsController#index as HTML
Parameters: {"user_id"=>"1"}
Completed 500 Internal Server Error in 1ms
NoMethodError (undefined method `all' for ActiveSupport::Configurable::Configuration:Class):
app/controllers/configurations_controller.rb:8:in `index'