Flowdock
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

yijisoo

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

e.g.

o = Object.new(:foo => 'bar')
o.save

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?