Trouble posting data to database

32 views
Skip to first unread message

Ian Baraza Brayoni

unread,
Aug 4, 2014, 12:43:35 AM8/4/14
to rubyonra...@googlegroups.com
Hi guys, 

Am trying to submit data through a text_area loaded by a partial form unsuccessfully thus far.

Please find my code here.

Any leads highly appreciated.

Thank you.

Marco Antonio Almeida

unread,
Aug 4, 2014, 3:28:50 AM8/4/14
to rubyonra...@googlegroups.com
Hi Ian,

Check out line 20 of you StudentIndisciplinesController: . You're passing a parameter that is nil according to your log. Also, if you want to have more than one student indiscipline being saved you will need to .save inside the .each loop. You're also unable to save because of the validation error thrown, since you're instantiating the object without a case.

Also, I would suggest that you do the things at your controller more restful. Your students action it looks like a create action and your list a index action, unless you have a good reason to do how you're doing.

Hope this helps.

Best regards,
Marco Antonio Almeida
+45 31 65 28 84
Twitter: @marcoafilho | LinkedIn: marco-antonio-almeida-filho


--
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/da216237-fd81-41af-81a0-4810778cea9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Colin Law

unread,
Aug 4, 2014, 3:58:27 PM8/4/14
to rubyonra...@googlegroups.com
On 4 August 2014 08:28, Marco Antonio Almeida <marco...@gmail.com> wrote:
> Hi Ian,
>
> Check out line 20 of you StudentIndisciplinesController: . You're passing a
> parameter that is nil according to your log. Also, if you want to have more
> than one student indiscipline being saved you will need to .save inside the
> .each loop. You're also unable to save because of the validation error
> thrown, since you're instantiating the object without a case.
>
> Also, I would suggest that you do the things at your controller more
> restful. Your students action it looks like a create action and your list a
> index action, unless you have a good reason to do how you're doing.

Also you might find it beneficial to work right through a good
tutorial such as railstutorial.org (which is free to use online) as
that will show you the basics of Rails.

Colin
> https://groups.google.com/d/msgid/rubyonrails-talk/CACMkcE44kK%2Bh_5mDfb1Hq2rk-%3Dj7hwaYwOowhm%2BjosJBnooRWw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages