On Tue, Nov 02, 2010 at 01:05:33PM +0100, Peter De Berdt wrote:
>
> On 02 Nov 2010, at 12:53, [email protected] wrote:
>
>> Why can I do this....
>>
>>  validates_uniqueness_of "username", :case_sensitive=>false
>>
>> .... but not this....
>>
>>   User.where "Xx", :case_sensitive=>false
>>
>> ?
>
> Validation happens through Ruby code, the case sensitivity for database 
> queries is determined by your database (as far as I know, MySQL and MSSQL 
> are case insensitive by default, PostgreSQL isn't).

That said, there is no reason why the second expression couldn't downcase
the passed string and generate SQL to compare it against the
LOWERCASE(column). Without the right index that would be pretty
inefficient, but it isn't an unreasonable feature to expect. Maybe someone
would feel like implementing it.

> Best regards
> Peter De Berdt
--Greg

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to