I have a many to many :through association in my rails application between 'User' and 'List' model objects.
#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
In the console if I attempt to select all the lists (User.first.lists) from a user I get the following error:
NameError: uninitialized constant User::UserList
I'm new to rails. I'm guessing I have something named wrong. Table names are as follows users, lists, user_lists
Can someone tell me what I have wrong here?