Colin Law wrote:
> On 15 July 2010 09:05, Rob Nichols <[email protected]> wrote:
>> Model.find_all_by_firstname(a.collect{|a| a.downcase})
>
> Will that work if the names in the db include upper case chars? I
> think the compare in the find needs to be case insensitive rather than
> what is being compared against being forced to lower case.
>
> Colin
If that's the case, this will do it:
class Model
self.find_all_by_firstname(first_name)
find(:all, :conditions => ["LOWER(firstname) = ?",
first_name.downcase])
end
end
--
Posted via http://www.ruby-forum.com/.
--
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.