It would be useful for issues such as http://www.redmine.org/issues/2473 (Login and mail should not be case sensitive) to support case insensitive finds via the dynamic finders. This is particularly a problem for postgresql users which is case sensitive by default. Currently people seem to be applying various workarounds (e.g. change from issue above or http://devblog.aoteastudios.com/2009/12/add-case-insensitive-finders-by.html) to deal with this. I''m not sure whether this is best done as an option to the finder or otherwise. Does anyone have any thoughts on the matter or pointers on implementation? Thanks Tristan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
where("LOWER(email) = ?", email) isn''t good enough? On Tuesday, 28 June 2011 at 6:07 AM, Tristan Hill wrote:> It would be useful for issues such as http://www.redmine.org/issues/2473 > (Login and mail should not be case sensitive) to support case > insensitive finds via the dynamic finders. This is particularly a > problem for postgresql users which is case sensitive by default. > > Currently people seem to be applying various workarounds (e.g. change > from issue above or http://devblog.aoteastudios.com/2009/12/add-case-insensitive-finders-by.html) > to deal with this. > > I''m not sure whether this is best done as an option to the finder or > otherwise. Does anyone have any thoughts on the matter or pointers on > implementation? > > Thanks > Tristan > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com (mailto:rubyonrails-core@googlegroups.com). > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com (mailto:rubyonrails-core+unsubscribe@googlegroups.com). > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
On 28 June 2011 01:14, Ryan Bigg <radarlistener@gmail.com> wrote:> where("LOWER(email) = ?", email) isn''t good enough?No. It''s a particular problem when using the dynamic "find_or_create_by_email(value)" and the ilk. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
The dynamic finders are just syntactic sugar for doing equality based queries. If your database''s collation isn''t case-insensitive and you want to do case-insensitive queries you''ll have to use where as ryan suggested. Expanding the functionality to support this isn''t warranted, just define a scope or use where. -- Cheers Koz On 28/06/2011, at 5:50 PM, Michael Pavling <pavling@gmail.com> wrote:> On 28 June 2011 01:14, Ryan Bigg <radarlistener@gmail.com> wrote: >> where("LOWER(email) = ?", email) isn''t good enough? > > No. > > It''s a particular problem when using the dynamic > "find_or_create_by_email(value)" and the ilk. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.