Mohammad Seif Mohammad Seif - 4 months ago 8x
Ruby Question

How to use params in rails by select form

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.


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

@selected_person = params[:post][:person_id]