You want to take a look at the SearchLogic GitHub Readme page:
http://github.com/binarylogic/searchlogic
So in your controller, you'll want something like:
class UsersController < ApplicationController
def index
@search = User.search(params[:search])
@users = @search.all
end
end
And in the view, SearchLogic comes with built in named scopes to
search.
So let's say you were working with users. And lets say you want to
search on the username.
<% form_for @search do |f| %>
<p>
Username: <br />
<%= f.text_field :username_like %>
</p>
<%= f.submit 'Search' %>
<% end %>
I hope this helps. Let me know if you have any questions.
On Apr 28, 6:54 am, swetha <[email protected]> wrote:
> I need help with simple search .I worked on railscasts example,but its
> not working.
> Can anyone give me an example of simple search logic.Thanks in Advance
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.