Rohan Deshpande wrote in post #955103: > 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
Try to find a more direct approach to your search features. You should reserve find_by_sql as an absolute last resort. Rails provides an extensive and power query language and the Rails community has provided some really nice gems to help with more complex searches: It might also be useful for you to try to explain your query in English. I could take the time to try to figure out what your code is supposed to do, but my time is valuable. I, as I'm sure others, would appreciate you take a little of your time to explain what you want instead of simply throwing the code into your post and making other decipher it. Just a suggestion, but the more clear your question the better help you will get from the community. http://guides.rubyonrails.org/active_record_querying.html http://github.com/binarylogic/searchlogic -- 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.