Skip to content

Instantly share code, notes, and snippets.

@rramsden
Created May 19, 2011 21:25
Show Gist options
  • Save rramsden/981785 to your computer and use it in GitHub Desktop.
Save rramsden/981785 to your computer and use it in GitHub Desktop.
RAILS 3.0.7
ruby-1.9.2-p136 :006 > c = Category.new(:title => "test")
=> #<Category id: nil, title: "test", created_at: nil, updated_at: nil>
ruby-1.9.2-p136 :007 > c.new_record?
=> true
ruby-1.9.2-p136 :008 > c.update_attribute(:title, "change me")
=> true
ruby-1.9.2-p136 :009 > c.new_record?
=> false
ruby-1.9.2-p136 :010 > c = Category.new(:title => "test")
=> #<Category id: nil, title: "test", created_at: nil, updated_at: nil>
ruby-1.9.2-p136 :011 > c.new_record?
=> true
ruby-1.9.2-p136 :012 > c.update_attributes(:title => '123')
=> true
ruby-1.9.2-p136 :013 > c.new_record?
=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment