Hi,

I have problem with my named scopes.

A membership has many property_details through join_property_details. I
do an anonymous named_scope to get all memberships hat have 'ns' and
'ae' as property_details. However I get always an empty search result.

    scope = scope.scoped(
     :conditions => ['property_details.short = ?', 'ns'],
     :include => :property_details )
    scope = scope.scoped(
     :conditions => ['property_details.short = ?', 'ae'],
     :include => :property_details )

SELECT DISTINCT `memberships`.id FROM `memberships`
LEFT OUTER JOIN `join_property_details` ON (`memberships`.`id` =
`join_property_details`.`membership_id`)
LEFT OUTER JOIN `property_details` ON (`property_details`.`id` =
`join_property_details`.`property_detail_id`)
WHERE (property_details.short = 'ae') AND (property_details.short =
'ns')

What do I have to do to get all memberships that have 'ns' and 'ae' as
property_details?

Thanks in advance
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to