README.rdoc in property_sets-0.0.10 vs README.rdoc in property_sets-0.0.11

- old
+ new

@@ -9,22 +9,38 @@ You configure the allowed stored properties by specifying these in an initializer: class Account < ActiveRecord::Base property_set :settings do property :version, :default => "v1.0" + property :featured property :product end property_set :texts do property :epilogue end end The declared properties can then be accessed runtime via the defined association: - account.settings.ssl # returns the value of the setting - account.settings.ssl=(value) # immediately changes the value of the setting - account.settings.ssl? # coerces the setting to boolean AR style + # Return the version record for this account - or a new record if none exists + account.settings.version + + # Create (or update) the version record with default value + account.settings.version.create + + # Create (or update) the version record with the given value + account.settings.version.create(:value => "v1.1") + + # Destroy the version record + account.settings.version.destroy + +On top of the basic access paths, there are some short cuts: + + account.settings.featured=(1) # immediately changes the value of the setting + account.settings.featured? # coerces the setting to boolean AR style + account.settings.featured.enable # sets the value of this setting to a true value + account.settings.featured.disable # sets the value of this setting to a false value If the value has never been set, a nil (or default) is returned. And that's pretty much it. Stored properties can also be updated with the update_attributes and update_attributes! methods by enabling nested attributes. See the test cases for examples. \ No newline at end of file