Skip to content

Instantly share code, notes, and snippets.

@DanCoughlin
Created June 27, 2012 19:16
Show Gist options
  • Save DanCoughlin/3006125 to your computer and use it in GitHub Desktop.
Save DanCoughlin/3006125 to your computer and use it in GitHub Desktop.
How to conditionally pass a parameter
<%= form_tag catalog_index_path, :method => :get, :id => "search-form-header" do %>
<%= search_as_hidden_fields(:omit_keys => [:q, :search_field, :qt, :page]).html_safe %>
<%= text_field_tag :q, params[:q] unless params[:q] == 'dashboard'?, :class => "q", :id => "search-field-header", :placeholder => "Type keywords in here" %>
<%= params[:controller] %>
<%= submit_tag 'Go', :id=>'search-submit-header' %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment