Displaying 1 result from an estimated 1 matches for "find_by_ad_enabled".
2006 Nov 27
0
how to select with a kind of through relation(has_one)
...not found; perhaps you misspelled
it?"
I tried to add to Item class
belongs_to :membership
And added Membership Class following
has_many :items, :through => :shops
but helaas not working. Any suggestion how to handle this situation?
Thanks in advance
class Item <....
def self.find_by_ad_enabled(options={})
ad_enabled do
self.find :all, {:order => "RAND()"}.merge(options)
end
end
protected
def self.ad_enabled
with_scope(:find => {:conditions => ''memberships.ad_enabled = 1 and
shops.expires_on >= NOW() and shops.enabled = 1'',...