Difference between modelname.new and modelname.create in rails? -
this question has answer here:
- rails new vs create 4 answers
when using rails console can type either:
paper.new(name: "deva", body: "testing") paper.create(name: "deva", body: "testing") and seems same result. difference between .new , .create?
new initialize object , not save object in database
create initializes save if validations met.
for see this: http://apidock.com/rails/activerecord/base/create/class
Comments
Post a Comment