I’m reading Rails Recipes, for the precision the recipe 52 that speak
about ‘Making your own Rails plugin’. The question, so stupid, is that i
don’t understand wath do the code
def self.search(query, fields, options = {})
find :all,
options.merge(:conditions => [[fields].flatten.map { |f|
“LOWER(#{f}) LIKE :query”}.join(’ OR ’ ),
{:query => “%#{query.to_s.downcase}%”}])
end
I think that:
query: is the text i search
fields: are the fields of Post in witch i search
options: ?
And then the command is a quite complicated for me, so i don’t
understand what it do. Thanks so much to all.