#127 new
junaid malik

searchlogic removes group clause.

Reported by junaid malik | June 13th, 2010 @ 01:49 AM

We have models like this
class User < ActiveRecord::Base
has_many :tenders, :select=>"tenders.id, tenders.name", :through=>:assignments, :group=>"tenders.id,

tenders.name", :source=>:assignable, :source_type=>'Tender'

class Tender < ActiveRecord::Base
named_scope :invited, :conditions => ["assignments.state IN (?)",["pending","requested"]] end

class Assignment < ActiveRecord::Base

If i fetch tenders of a user like this User.find(1).tenders.invited, it works fine.
But if i fetch tenders using following way then it remove group by clause of sql.
opt = {}
opt[:invited] = true


Any help why is searchlogic removing 'group by' clause? We can't rely on 'User.find(1).tenders.invited' for fetching tenders because this is not simplified way to manage many named_scopes and other search operators.


No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket