Forum: Ruby on Rails Model.create(!) doesn't add to database, no errors..

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7109613c18172c5d915f0d197a6d978e?d=identicon&s=25 Robert Gleeson (rpag)
on 2008-10-07 20:27
(Received via mailing list)
Hi,

I am trying to get form submitted data be submitted to my database,
however not matter what I try it won't work. in script/console
Model.create(args) adds to the database just fine.

pastie is here

I've tried .create(!), .save after it, and Model.new in the action
index.
Thanks for any help
247cd3d37084a3d6794076207bd9fbd7?d=identicon&s=25 Bobnation (Guest)
on 2008-10-07 20:47
(Received via mailing list)
Could you post your code so we can take a look at the actual actions?
74198b06bc9e68739debfe6c23e070d3?d=identicon&s=25 Kieran P (Guest)
on 2008-10-07 21:42
(Received via mailing list)
Hello,

The correct syntax is

Model.create!(@attributes)

with the bang/exclamation point (!)  after create, before the
parentheses
(not in them).

See
http://apidock.com/rails/ActiveRecord/Validations/...!

Regards
Kieran
This topic is locked and can not be replied to.