just SOLVED it ... :resource_type => "" is wrong should
be :resource_type => nil,
I''ll change my glasses
On 14 oct, 12:40, Erwin <yves_duf...-ee4meeAH724@public.gmane.org>
wrote:> Is there any way to write this working query :
>
> Admin.select("DISTINCT `admins`.*").joins("LEFT OUTER JOIN
> `admins_roles` ON `admins_roles`.`admin_id` >
`admins`.`id`").joins("LEFT OUTER JOIN `roles` ON
> `admins_roles`.`role_id` =
`roles`.`id`").where("roles.resource_type
> IS NULL AND roles.name = ?", "manager")
>
> in Rails ActiveRecord "dialect" ?
>
> I tried ( Admins and Roles are associated w an HMABT association
>
> Admin.joins(:roles).where(:roles => {:resource_type => "",
:name
> => :manager})
> this doesn''t work
>
> If I only write :
> Admin.joins(:roles).where(:roles => {:name => :manager})
> this works, but I get all ;manager with any resource_type
>
> thanks for feedback
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.