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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -