v1.2.6 - Show latest stable - 3 notes - Class: ActiveRecord::Base
create(attributes = nil) public

Creates an object, instantly saves it as a record (if the validation permits it), and returns it. If the save fails under validations, the unsaved object is still returned.

Show source
Register or log in to add new notes.
December 13, 2009
1 thank


create generates the object and saves. new only generates the object.


o = => 'bar')

is the same as

o = Object.create(:foo => 'bar')
December 13, 2009
0 thanks

What's difference between create and new?

What’s difference between create and new?

May 25, 2016 - (v1.0.0 - v3.1.0)
0 thanks