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
on 2012-10-14 12:41
on 2012-10-14 12:53
just SOLVED it ... :resource_type => "" is wrong should be :resource_type => nil, I'll change my glasses
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.