class Agents << ActiveRecord::Base
belongs_to :customer
belongs_to :house
end
class Customer << ActiveRecord::Base
has_many :agents
has_many :ho
Another way to add associations is by using the foreign key columns:
agent = Agent.new(...)
agent.house = House.find(...)
agent.customer = Customer.find(...)
agent.save
Or use the exact column names, passing the ID of the associated record instead of the record.
agent.house_id = house.id
agent.customer_id = customer.id