On 26 September 2014 14:07, Sai Ch <[email protected]> wrote:
> Vivek Sampara wrote in post #1158513:
>> Is choice method defined anywhere ? >>>> " if choice == 1 "
>>
>> And keep your permitted params method outside create.
>> def create
>>
>> end
>>
>>   def webnairs_params
>>     if choice == 1
>>     params.require(:webnair).permit(:user_id, :ppt, :choice, :title,
>> :description)
>>     else
>>     params.require(:webnair).permit(:user_id, :presentation_id, :choice,
>> :title, :description)
>>    end
>> end
>
> yes I've created strong perams outside create.
> No I don't create anywhere choice method but i get choice value from
> form tag i.e
>
> <%= f.radio_button :choice, "1" %>
> <%= f.label :choice, "New Presentation", :value => "1" %>
>
> <%= f.radio_button :choice, "0" %>
> <%= f.label :choice, "select Presentation", :value => "0" %>

That does not make a variable called choice available in the
controller action, it should make it availble via the params hash
though.  Check in development.log to check whether it is being passed
ok and put some debug in your code to see what is happening.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLtKbDQrGXizrwV8xVz8wxKUC2Pyh72bdaFBdXynAzmzwA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to