Railsアプリケーションの「User」モデルオブジェクトと「List」モデルオブジェクトの間には、多対多の:throughアソシエーションがあります。
#user.rb
class User < ActiveRecord::Base
attr_accessible :email, :password, :username
has_many :user_lists
has_many :lists, :through => :user_lists
end
#list.rb
class List < ActiveRecord::Base
has_many :user_lists
has_many :users, through => :user_lists
attr_accessible :description, :title
end
#userlist.rb
class UserList < ActiveRecord::Base
belongs_to :user
belongs_to :list
end
コンソールで、ユーザーからすべてのリスト(User.first.lists)を選択しようとすると、次のエラーが発生します。
NameError:初期化されていない定数User :: UserList
Railsは初めてです。名前が間違っていると思います。テーブル名は次のとおりですusers、lists、user_lists
誰かが私がここで間違っていることを教えてもらえますか?