#118 new
Remo Fritzsche

Searchlogic order does not overwrite models default_scope order?

Reported by Remo Fritzsche | February 8th, 2010 @ 03:50 AM

When I specify the default ordering in the model like this

   default_scope :order => 'name ASC'

and define something like this in the controller

   @search = MyModel.search(params[:search])
   @search.order ||= :ascend_by_name
   @count = @search.count

the thing will always be ordered by name, even if there is something set by the user. If I out-comment the default_scope, everything works as expected.

May this be a bug or am I doing something wrong? I'm using searchlogic 2.3.3.

Thanks a lot!

Comments and changes to this ticket

  • Martin Streicher

    Martin Streicher August 7th, 2010 @ 07:55 AM

    • Milestone order changed from “0” to “0”

    Setting current_scope to an empty hash can have unintended consequences, especially if @search is derived from an association.

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