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
So you’re using SearchLogic?
You want to take a look at the SearchLogic GitHub Readme page:
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| %>
Username:
<%= f.text_field :username_like %>
I hope this helps. Let me know if you have any questions.