search for: shops_at_id

Displaying 2 results from an estimated 2 matches for "shops_at_id".

2005 Dec 27
3
Trouble combining :has_many, :finder_sql and :conditions to create a sub-search
...ng like: class Store < ActiveRecord::Base has_many :people, :dependent => true, :finder_sql => ''SELECT DISTINCT p.* FROM people p WHERE (p.works_for_id = #{id} OR p.shops_at_id = #{id})'', :order => "updated_on DESC" end Meanwhile people is an STI: class Person < ActiveRecord::Base end class Employee < Person belongs_to :store, :foreign_key => ''works_for_id'' end class Shopper &l...
2005 Dec 27
0
How do I combine :finder_sql and :conditions to perform a sub-search on a custom has_many relationship?
...mething like: class Store < ActiveRecord::Base has_many :people, :dependent => true, :finder_sql => ''SELECT DISTINCT p.* FROM people p WHERE (p.works_for_id = #{id} OR p.shops_at_id = #{id})'', :order => "updated_on DESC" end Meanwhile people is an STI: class Person < ActiveRecord::Base end class Employee < Person belongs_to :store, :foreign_key => ''works_for_id'' end class Shopper <...