:select broken with will_paginate
Reported by darix | November 8th, 2007 @ 10:42 PM
@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 November 10th, 2007 @ 02:59 AM
- Assigned user changed from Chris Wanstrath to Mislav
- State changed from new to open
-
Mislav January 31st, 2008 @ 11:14 PM
- State changed from open to resolved
This was resolved a long time ago, closing the ticket. Report if I'm wrong.
-
Yong Bakos August 18th, 2008 @ 10:01 PM
- 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.
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!