Skip to content

Instantly share code, notes, and snippets.

@amardaxini
Created April 4, 2012 07:06
Show Gist options
  • Save amardaxini/2299394 to your computer and use it in GitHub Desktop.
Save amardaxini/2299394 to your computer and use it in GitHub Desktop.
search
<%= form_tag('/auctions',:method=>:get) do %>
<%= select_tag "category_id", options_from_collection_for_select(Category.all, "id", "name") %>
<%= submit_tag %>
<% end %>
#In your controller
def index
if params[:category_id]
category= Category.find(params[:category_id])
@auctions = category.auctions
else
@auctions = Auctions.all
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment