在Ruby on Rails的,什么是创造,创造的区别!和API文档没有它?
问题描述:
ActiveRecord的有创建
有的人用创造!
...这是不是创造!
可以抛出一个异常,而创建
不?我找不到创造!
的
目前Rails的API文档...
ActiveRecord has create
and some people use create!
... Is it that create!
can raise an exception while create
doesn't? I can't find create!
in
the current Rails API docs...
答
是创造!
将提高对故障异常,创建
刚刚返回false。文件位置:
Yes, create!
will raise an exception on failure, create
just returns false. Documentation here:
http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-create-21