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