Croplio Croplio - 6 months ago 9
Ruby Question

How to know whether a model is new or not?

class Post < ActiveRecord::Base
end

post = Post.new


How do I judge whether the 'post' is a new model which is not pulled from the database?

Answer
post.new_record?
Comments