Individual Form Params when POST data is split
I'm trying to access a date variable from a form individually to the other variables. The form is a formtastic plugin form. The issue I am facing is that t开发者_如何学Gohe date is a three-part dropdown and simply doing params[:friend][:born_on] doesn't seem to be doing the trick as it returns NULL.
Here is my parameters output;
Parameters: {"commit"=>"Create", "action"=>"create", "authenticity_token"=>"6+PyuqUNQySe29iEF69PIFvv6DOie5bp4jZAcRva85c=", "controller"=>"friends", "friend"=>{"born_on(1i)"=>"1973", "born_on(2i)"=>"3", "born_on(3i)"=>"5", "is_female"=>"false", "last_name"=>"Smith", "first_name"=>"John"}}
I want to use the variable to set another method; event.happening_on
Any help is appreciated- thanks!
The reason params[:friend][:born_on] is not returning anything is because that's not the name of the parameter.
It looks like the values you're looking for is one of: params[:friend]["born_on(1i)"]
, params[:friend]["born_on(2i)"]
, or params[:friend]["born_on(3i)"]
. Which corresponds to what looks like, year, month and day respectively.
精彩评论