ruby on rails - How do I find all the records regardless of case -


what can find case insensitive search

>> band.find_by_name("metallica") => nil >> band.find_by_name("metallica") => #<band id: 3, name: "metallica", created_at: "2010-10-03 01:17:24", updated_at: "2010-10-03 01:17:24", user_id: "4"> 

i need find record in both cases...any suggestions?

band.find(:all, :conditions => ['name = lower(?)', band_name.downcase]) 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -