This project is archived and is in readonly mode.

#23 ✓resolved
Alex MacCaw

validates_uniqueness_of doesn't escape attributes

Reported by Alex MacCaw | April 19th, 2008 @ 09:39 AM

Let's say I have a table with a column called 'key' (which is a SQL keyword). If I try and validate_uniqueness_of :key, the SQL query fails, since the attribute 'key' isn't escaped:

SELECT key FROM `api_tickets` WHERE (LOWER(`api_tickets`.key) = 'asdsd')

Should be:

SELECT `api_tickets`.key FROM `api_tickets` WHERE (LOWER(`api_tickets`.key) = 'asdsd')

Patch is attached.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages