I read through the API for Active Record Querying, but it doesn\'t seem to include a method for the user to actually input search data. I assume I could somehow link_to a method
the simple way to do it is
Model.find(:all, :conditions => ['name LIKE ?', "%#{search}%"])
in View
<% form_tag projects_path, :method => 'get' do %>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
<% end %>
In Controller
def index
@projects = Project.search(params[:search])
end
In Models
def self.search(search)
if search
find(:all, :conditions => ['name LIKE ?', "%#{search}%"])
else
find(:all)
end
end