Mohammad Seif Mohammad Seif - 1 year ago 107
Ruby Question

How to get params from select form in rails

I have this code in my view:

<% select("post", "person_id", Person.all.collect {|p| [, ] }, {include_blank: true }) %>

I want to get value of
from params.

When I am trying

@person_Select = params[:post[person_id]]

I am getting error.

Answer Source

You should use below way to get your params in controller:

@selected_person = params[:post][:person_id]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download