0

I have view

<%= form_tag('filter_ebook', :method => :post, :remote => true) do %>
  Filter By: <%= select_tag "action", options_for_select(search_price),:onchange => "this.form.submit();" -%>
<%end%>

Routes

resources :ebooks do
collection do
  get 'search'
  post 'filter_ebook'
end
end

I have applied on action on change of dropbox, but when I have saw param in action there is no value of selected value of dropbox.

I got {"utf8"=>"✓", "authenticity_token"=>"wnsNDzco60UdjEfOggtmnGCxhY1rzyVSm4WCCdt12Fs=", "action"=>"filter_ebook", "controller"=>"ebooks"}

But I want selected value in action how can I get it?

Matt Gibson
  • 14,616
  • 7
  • 47
  • 79
  • 3
    It's not a good idea to use a parameter named `action`. It may conflict with Rails. Try with another name. See http://stackoverflow.com/questions/4671732/why-cant-i-use-a-param-called-action – Baldrick May 31 '13 at 14:02
  • Also, when inside a form_tag, you have a reference back to the form passed to your block and you can use that to make the select with `<%= f.select, options_for_select %>` (etc) – jxpx777 May 31 '13 at 14:16

1 Answers1

0

"action" is always the name of the controller's action - the one that is provided by the route, in your case "filter_ebook".

Just give your parameter a different name, like "action_type"

Matthieu
  • 1,149
  • 7
  • 11