#59 ✓resolved
sumeet koshal

page_links or remote_page_links doesn't work

Reported by sumeet koshal | March 1st, 2009 @ 10:50 PM


I was quite excited to use searchlogic in my project until I knocked out by few issues as below:

  1. page_links or remote_page_links doesn't works for me.
  2. conditions.group doesn't work either.

Here are some more details on issue no. 1


You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.-

Extracted source (around line #12):


Trace of template inclusion: /user/_list_items.erb, /user/index.html.erb

vendor/plugins/searchlogic/lib/searchlogic/helpers/control_types/links.rb:121:in page_links' app/views//layouts/_paginator.erb:12:inrun_erb_47app47views47layouts47_paginator46erb' app/views/user/list_items.erb:3:in _run_erb_47app47views47user47_list_items46erb' app/views/user/index.html.erb:10:in_run_erb_47app47views47user47index46html46erb' app/controllers/user_controller.rb:35:in index'

Any quick help will greatly be appreciated.

Thanks Sumeet

10: <% if @search.page_count > 1 %> 11:
12: <%= page_links :remote => {:update => "list_items"} %> 13:
14: <% end %> 15:

Comments and changes to this ticket

  • sumeet koshal

    sumeet koshal March 3rd, 2009 @ 04:58 AM

    Hi Ben,

    Can you please help me with problem asap?

    Thanks Sumeet

  • Ben Johnson

    Ben Johnson March 3rd, 2009 @ 05:02 AM

    • State changed from “new” to “open”

    Hi, I can't really solve the problem with the given information. What version of rails are you using? This doesn't sound like a searchlogic problem, it sounds like a problem that is deeper, for some reason modules are getting required / loaded.

  • sumeet koshal

    sumeet koshal March 3rd, 2009 @ 05:09 AM

    I am using rails-2.0.1

  • sumeet koshal

    sumeet koshal March 4th, 2009 @ 10:34 PM

    Hi Ben,

    I am still waiting for you to help me with this. Can we work towards closing this issue

    Thanks Sumeet

  • Ben Johnson

    Ben Johnson March 6th, 2009 @ 05:43 AM

    • State changed from “open” to “resolved”

    Hi Sumeet, I have other things to do just like you, I apologize if this wasn't my #1 priority this week.

    Regardless, none of your messages clearly state what the problem is. I can't solve this because I don't know what the problem is.

    Have you considered updating rails? There is no reason you should be getting this error as I have multiple tests in place and an example / demo app that is working just fine. I think you problems might be attributed to your rails version. If you can update I would recommend that, or at least give it a shot.

  • sumeet koshal

    sumeet koshal March 25th, 2009 @ 04:27 AM

    • Tag set to against, association, attribute, problem, searching, when

    Hi Ben,

    I got this problem resolved by removing a plugin named "paginating_find".

    However, I am stuck into a new problem now. Consider a example where we have a model like:

    Class User < Activerecord::Base

    belongs_to :user_group, :class_name=>"Group", foreign_key=>"group_id"


    Now consider the below action in UserController:

    def index

    query_all = params[:query_all]
    warn "#{params.inspect}"
    @search = User.new_search(params[:search])
    @users = @search.find :all
    @count = @search.count("users.id")
    respond_to do |wants|
      wants.html # Default will render the html page.
      wants.js  # Default will render the rjs page.


    Calling this actions blow up and spits following error in the log file...

    ActionView::TemplateError (Mysql::Error: #23000Column 'id' in field list is ambiguous: SELECT count(DISTINCT id) AS count_id FROM users LEFT OUTER JOIN groups ON groups.id = users.group_id WHERE (groups.name LIKE '%TK %' AND (users.is_app_acct = 0))) on line #10 of layouts/_paginator.erb: 7: 8: 9:

    10: <% if @search.page_count > 1 %> 11:
    12: <%= page_links %> 13:


    It works just fine if you are not searching against association attribute...

    can you please provide me a fix for this?

    Thanks Sumeet

  • sumeet koshal

    sumeet koshal March 25th, 2009 @ 05:05 AM

    I found a workaround to this problem.

    In my UserController index action, I added this line of code:

    User.set_primary_key "users.id"

    Not sure if there is any other sensible way.

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