I am new to ROR...  I want to search in database using user input.. I am
using sqlite database.
Can anyone guide me?

so far I have done following in model.. I am going in correct way?

Photo_search.rb

def self.search(query)
   if !query.to_s.strip.empty?
   find_by_sql(["select p.* from photos where #{ (["(lower(p.title) like
?
   or lower(p.description) like ?)"] * tokens.size).
   else
      []
   end
end

Please help/suggest.

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to