Displaying 2 results from an estimated 2 matches for "is_supervisor".
2006 May 30
0
Single table lookups
I''m struggling with a single table type (self) lookup.
my ''personnel'' model has a supervisor_id and is_supervisor column.
The supervisor''s select list is created by
@supv = Personnel.find(:all,
:conditions => ["is_supervisor = true"],
:order => ''last_name'')
in my personnel model, I have the following...
def supervisor
if Personnel.find_by_id(self.supe...
2006 Feb 07
3
help with relationship
Let''s imagine we are modelling a company that have several shops. I
have a Worker model and a Shop model. A worker belongs_to a shop, and
each shop has_many workers. But, in a shop there''s a distinguished
worker that is the supervisor
create table shops (
...
worker_id integer -- the supervisor
);
How would you express this relationship?