Plugins - Dirty

StarAdd to favorites

A newly instantiated object is unchanged:
person = Person.find_by_name('uncle bob')
person.changed? # => false

Change the name:
person.name = 'Bob'
person.changed? # => true
person.name_changed? # => true
person.name_change # => ['uncle bob', 'Bob']
person.name = 'Bill'
person.name_change # => ['uncle bob', 'Bill']

Save the changes:
person.save
person.changed? # => false
person.name_changed? # => false

Assigning the same value leaves the attribute unchanged:
person.name = 'Bill'
person.name_changed? # => false
person.name_change # => nil

Which attributes have changed?
person.name = 'bob'
person.changed # => ['name']
person.changes # => { 'name' => ['Bill', 'bob'] }

bitsweat

http://code.bitsweat.net/svn/dirty/

  • Currently 5.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Assets

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?