README.md in user_preferences-1.0.0 vs README.md in user_preferences-1.0.1

- old
+ new

@@ -33,13 +33,31 @@ ```sh $ rake db:migrate ``` +## Add preferences to your model + +Assuming you have a model called `User`, you can associate it with preferences as +follows: + +```ruby +class User < ActiveRecord::Base + + has_preferences + + # the rest of your code ... +end +``` + +This declaration takes no arguments, and simply sets up the correct associations +along with making available the rest of the methods described in the _API_ section +below. + ## Defining preferences -Your preferences are defined in ``config/user_preferences.yml``. You define each of your +Your preferences, along with their default values, are defined in ``config/user_preferences.yml``. You define each of your preferences within a category. This example definition for a binary preference implies that users receive emails notifications by default but not newsletters: ```yaml emails: notifications: true newsletters: false @@ -105,11 +123,11 @@ ## Scoping users ```ruby newsletter_users = User.with_preference(:email, :newsletter, true) #=> an ActiveRecord::Relation ``` -Note: this _will_ include users who have not overriden the default value if the value incidentally matches the default value. +Note: this _will_ include users who have not overridden the default value if the value incidentally matches the default value. ## Other useful stuff ### Single preference definition * Get your preference definition (as per your .yml) as a hash: ``UserPreferences.definitions`` @@ -132,6 +150,6 @@ 1. Fork it ( http://github.com/mubi/user_preferences/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request \ No newline at end of file +5. Create new Pull Request