Displaying 4 results from an estimated 4 matches for "works_for".
Did you mean:
workfor
2006 Mar 08
0
combining STI + polymorphism + rich self HABTM : how to ?
Hi all,
I need to model simple typed polymorphic relations:
''John'' [''works_for''] ''Bill''
''John'' [''speaks_for''] ''Microsoft''
''Microsoft'' [''hold_shares_of''] ''Apple''
I''m having a hard time combining :
- S.T.I. : '...
2005 Dec 27
3
Trouble combining :has_many, :finder_sql and :conditions to create a sub-search
...wish to
use the :finder_sql parameter to essentially ''or'' the two foreign
keys.
What isn''t working for me is performing a ''sub-search''.
Let''s say the tables are "stores" and "people," and the relationships
are called "works_for" and "shops_at."
I want to have a single "has_many" relationship that encompasses the
people who visit a store. Something like:
class Store < ActiveRecord::Base
has_many :people,
:dependent => true,
:finder_sql => '...
2006 Mar 12
0
NameError when trying to combine Recipe 14 (rich HABTM) & Rec. 10 (self-ref HABTM):
...ttr: source_id, target_id)
(more details below)
ex: John ''works for'' Bob
1> jsmith = Person.create(:name => ''John Smith'')
2> jdoe = Person.create(:name => ''John Doe'')
3> jsmith.to_relations.create(:name => "works_for", :target => jdoe)
4> assert_equal 1, jsmith.slaves.size
>>>>
NameError: activesupport/lib/active_support/dependencies.rb:106:in
`const_missing'': uninitialized constant Slafe
Models
------------------------------------
class Person < ActiveRecord::B...
2005 Dec 27
0
How do I combine :finder_sql and :conditions to perform a sub-search on a custom has_many relationship?
...wish
to use the :finder_sql parameter to essentially ''or'' the two foreign
keys.
What isn''t working for me is performing a ''sub-search''.
Let''s say the tables are "stores" and "people," and the relationships
are called "works_for" and "shops_at."
I want to have a single "has_many" relationship that encompasses the
people who visit a store. Something like:
class Store < ActiveRecord::Base
has_many :people,
:dependent => true,
:finder_sql => ''...