In Ruby on Rails, what's the difference between create and create! and API docs doesn't have it?
问题 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... 回答1: 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 回答2: I have tested it in Rails 4.2.0 . In this version of Rails, it seems, #create! works as said in the other answer, but