Help needed in specifying conditions in pagination

Hi,
In a controller, I add to the default list action a condition, thus:

def list
@user_pages, @users = paginate :users,
:conditions => @query,
:per_page => 10
end

and @query is defined somewhere in the controller as

@query = “user_name like ‘%Smith%’”

where user_name is an attribute of User.

Result: The condition pulls out the whole table, not just the users with
partial name value “Smith”.

What’s the correct way of specifying a condition in pagination using a
variable? (Can’t find an example in the Rails API doc).

Thanks for the help,
gk

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs