#150 ✓resolved
darix

:select broken with will_paginate

Reported by darix | 2007-11-08 22:42:18 UTC

@users = User.paginate :page => params[:page], :order => 'login', :per_page => 30 , :select => 'login, fullname'

gives you the following SQL error.

Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' fullname) AS count_login_fullname FROM users' at line 1: SELECT count(login, fullname) AS count_login_fullname FROM users
User.find :select => 'login, fullname'

properly generates

SELECT login, fullname FROM users

Comments and changes to this ticket

  • Chris Wanstrath

    Chris Wanstrath 2007-11-10 02:59:18 UTC

    • Assigned user changed from “Chris Wanstrath” to “Mislav”
    • State changed from “new” to “open”
  • Mislav

    Mislav 2008-01-31 23:14:59 UTC

    • State changed from “open” to “resolved”

    This was resolved a long time ago, closing the ticket. Report if I'm wrong.

  • Yong Bakos

    Yong Bakos 2008-08-18 22:01:57 UTC

    • Tag set to “count, options, sql, will_paginate”

    Actually, this bug still emerges when attempting a SELECT DISTINCT * (:select => 'DISTINCT *')

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 ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket

Pages