How will I convert this into searchlogic query?


@students = Students.find_by_sql(["SELECT DISTINCT * FROM students
WHERE first_name LIKE ? OR last_name LIKE ? GROUP BY first_name,
last_name, middle_name", params[:first_name], params[:last_name] ])

Thank you,

Jade

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

Search Discussions

  • John Hinnegan at Feb 9, 2012 at 5:39 pm
    Pretty sure something like this will work
    Students.where("first_name like ?", params[:first_name]).or("last_name like
    ?", params[:last_name]).group("first_name, last_name, middle_name").uniq

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/IzHZx7Q78uQJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 9, '12 at 4:47p
activeFeb 9, '12 at 5:39p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Jade Zallao: 1 post John Hinnegan: 1 post

People

Translate

site design / logo © 2021 Grokbase