Displaying 2 results from an estimated 2 matches for "household_id".
2006 Apr 27
3
Removing a default value for a foreign key with not null set
Hi all,
For various reasons I need to have foreign keys with not null constraints.
Eg:
create_table :people do |t|
t.column :name, :string
t.column :household_id, :integer, :null => false
end
create_table :households do |t|
t.column :name, :string
end
add_foreign_key_constraint :people, :household_id, :households, :id
So the people table has a foreign key into households (household_id), and
not null is enabled on the column.
My problem is...
2005 Jul 14
1
Single-table inheritance and eager loading
...ple table with four types of people: clients, spouses,
children, and others all setup using single-table inheritance with a
foreign key back to a household record.
A Household has_one client and spouse, and has_many children and
others. I want to use a single "Household.find(@session
[:household_id], :include => [:client, :spouse, :children, :others])"
Unfortunately this generates the following error: "Not unique table/
alias: ''people''" with a mammoth query afterwards bulling in the same
columns from people four times.
Does ActiveRecord simply not let...