Displaying 3 results from an estimated 3 matches for "boss_id".
Did you mean:
boost_id
2007 Jul 26
1
Bi-directional self-referential HABTM
...onal.
I have a Employee class. Each employee can have a couple of bosses,
who are also employees. The employee class has the following HABTM:
has_and_belongs_to_many :bosses, :class_name =>
"Employee", :join_table => "bosses_courses", :association_foreign_key
=> "boss_id", :foreign_key => "employee_id"
Now this works fine.. but only one way. I can get all bosses of an
employee but I can''t get all employees of a boss.
In hindsight I think it probaby would have been better to use
a :through relationship for this, but I can''t real...
2006 Jul 17
14
REST Relationship Models
I''m trying to figure out an elegant way to do this:
I have the following three tables:
people, employer, employees
And consequently the following three models:
class Person < ActiveRecord::Base
end
class Employer < ActiveRecord::Base
has_many :employees
end
class Employee < ActiveRecord::Base
belongs_to :person
belongs_to :employer
end
I want to be able to say:
2006 Jan 05
13
Naming convention for foreign keys
Hi,
In "Agilge Web Development With Rails" on page 217, an example of
foreign keys is shown.
I am however unable to find a definition of wheater the naming of the
index is significant. On the above mentioned page, this line is shown in
the example:
constraint fk_items_product foreign key (product_id) references
products(id)
In "fk_items_product", "items" is