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.
Robert G. (Guest)
on 2008-10-07 22: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
Bobnation (Guest)
on 2008-10-07 22:47
(Received via mailing list)
Could you post your code so we can take a look at the actual actions?
Kieran P (Guest)
on 2008-10-07 23: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.