I am having a hard time with more advanced association in Rails.
Here is what I want to do:
landlord can create many properties, and they all belongs to the a landlord
each property can have many tenants, and each tenants can only belong to one property.
the land lord should be able to able to use CRUD on new tenants in each of his respective property.
the tenants can only see attributes/status related to their own property
Here is what I think how it should be laid out
class User < ActiveRecord::Base belongs_to :tenant, polymorphic: true end class Property < ActiveRecord::Base has_many :users, as: :tenant belongs_to :landlords end class Landlord < ActiveRecord::Base has_many :property has_many :users, as: :tenant, through: :properties end
Is this correct?
Is it better/less convoluted without the polymorphic association, and just use the through association?