Hi,

I have a Model named User.

It has two columns firstname, lastname.

There a record with id=1, firstname="srikanth" and lastname="Jeeva"

While Using search:

keyword =  "Srikanth Jeeva"

And I write a Query:

User.find(:all, :conditions=>["firstname like ? or lastname like ?",
'%keyword%', '%keyword%'])

Ofcourse this will give 0 result, as firstname is "srikanth" and i'm
searching for "Srikanth Jeeva"

How can i write query for firstname and lastname, so that I can get the
record.

-- 
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