search for: works_for_id

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

2005 Dec 27
3
Trouble combining :has_many, :finder_sql and :conditions to create a sub-search
...who visit a store. Something 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'&...
2005 Dec 27
0
How do I combine :finder_sql and :conditions to perform a sub-search on a custom has_many relationship?
...eople who visit a store. Something 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''...