Difference between modelname.new and modelname.create in rails? -


this question has answer here:

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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -