Displaying 2 results from an estimated 2 matches for "shops_at".
2005 Dec 27
3
Trouble combining :has_many, :finder_sql and :conditions to create a sub-search
...ql 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 => ''SELECT DISTINCT p.*...
2005 Dec 27
0
How do I combine :finder_sql and :conditions to perform a sub-search on a custom has_many relationship?
...ql 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 => ''SELECT DISTINCT p.*...