Ruby on Rails Tuesday, December 2, 2014

On Dec 2, 2014, at 11:39 AM, Dmoneyzzz Darko <lists@ruby-forum.com> wrote:
>
> I just don't know how
> appointment_date can be sent to the db and not appt_completion if they
> were both created in the same manner.

Note what's different in your form between appt_completion and other input elements: you're using plain tag helpers instead of the form methods, radio_button_tag instead of f.radio_button, which means the appt_completion parameters are not going to be associated with the record associated with the form via form_for.

And while I was typing this, Hassan gave another hint, which is EXTREMELY important. Look at the log when you submit the form, and examine the parameters. You MUST do this if you want to see what is happening.

The tutorial should help you understand how form data is submitted, how RoR parses it, and how it is passed through to your controller action. It's not magic, the forms are just HTML, and the RoR methods that generate input elements use conventions regarding the element names & ids used in that HTML, and then other RoR methods expect those conventions when receiving the data from the browser.

But ultimately, the parameters as parsed by RoR are the first place to look for "where did my data go" questions, because that's where you figure out whether the form is not configured to submit the data correctly, or whether the problem is in how you're handling the data--is the problem in the form or the controller.

--
Scott Ribe
scott_ribe@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




--
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/278DDAE2-AE73-49AD-A5BA-87AB818F9286%40elevated-dev.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment