I have 3 models,
Users, Location, Items
Location would only have 1 user, but User has many items or locations. and Items belongs to user or location.
class Location < ActiveRecord::Base
belongs_to :user
has_many items, through: :users
end
class User < ActiveRecord::Base
has_many :locations
has_many :items
end
class Item < ActiveRecord::Base
belongs_to :user
end
But I'm getting this error:
Could not find the association :users in model Location
I know, I can add has_many :users
in Location model, but location is supposed to only have 1 user.