Ruby on Rails Thursday, October 15, 2015

Thanks for taking a look! The "event_select" was what I was passing from the event view. The event_selected was how I was using that in the invitation new form. I was trying to seperate the names so if something broke I knew where it was bringing up the error. I have found that sometimes the naming of objects in rails seems redundant in the examples and it's hard to figure out what exactly is calling what. 

On Wednesday, October 14, 2015 at 12:36:39 PM UTC-5, Brent wrote:
I noticed a discrepancy in the field name:

def new  @event_selected = Event.find(params[:event_select])

...

Parameters:     {"utf8"=>"✓",   "authenticity_token"=>"GMMg9DwnTRAw4qP/ICqgACUB4d42Pl9Y7hrrNQzO38K8inbgyM00H2etrepjrT35hwIenHfwQPQW08V6QnHl1A==",   "event_selected"=>"14",

In the find query, you're using :event_select, and in the posted parameters, its :event_selected.

As Fred pointed out, your use of strong parameters and the form helpers seems wrong, but aside from those problems, it looks like you're not actually calling your "invite_params" method anyways. If you want to make use of strong parameters, in "new", you would use, Event.find(invite_params[:event_selected]).

Best,
Brent


--
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/9c22e2ca-1b3a-415d-adeb-62ed64c718e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment