Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add README notes on latest tracking features

  • Loading branch information...
commit 9793648a5c8d7163595d2b98ec02d0c781ecab88 1 parent 3a34307
@obrie obrie authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 README.rdoc
View
21 README.rdoc
@@ -181,6 +181,27 @@ Preferences are treated in a similar fashion to attributes. For example,
Preferences are stored in a separate table called "preferences".
+=== Tracking changes
+
+Similar to ActiveRecord attributes, unsaved changes to preferences can be
+tracked. For example,
+
+ user.preferred_language # => "English"
+ user.preferred_language_changed? # => false
+ user.preferred_language = 'Spanish'
+ user.preferred_language_changed? # => true
+ user.preferred_language_was # => "English"
+ user.preferred_language_change # => ["English", "Spanish"]
+ user.reset_preferred_language!
+ user.preferred_language # => "English"
+
+Assigning the same value leaves the preference unchanged:
+
+ user.preferred_language # => "English"
+ user.preferred_language = 'English'
+ user.preferred_language_changed? # => false
+ user.preferred_language_change # => nil
+
== Testing
Before you can run any tests, the following gem must be installed:
Please sign in to comment.
Something went wrong with that request. Please try again.