Ruby on Rails
Friday, September 26, 2014
if you should check it like
if params[:choice].to_s == "1"
#do something
#do something
else
#do something else
end
end
On Fri, Sep 26, 2014 at 6:37 PM, Sai Ch <lists@ruby-forum.com> 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" %>
--
Posted via http://www.ruby-forum.com/.
--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/3a1a2b7c312412d2991d94d86c6ede03%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAFKVRj8BC0Cnf5FrtcRTs-DCVGi84Trqd_OFEPrCv%2BCC4K_bAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment