README.rdoc in property_sets-0.4.0 vs README.rdoc in property_sets-0.4.1

- old
+ new

@@ -30,9 +30,26 @@ account.settings.featured? # Short hand for setting one or more values account.settings.set(:version => "v1.2", :activated => true) +=== Validations + +Property sets supports standard AR validations, although in a somewhat manual fashion. + + class Account < ActiveRecord::Base + property_set :settings do + property :version, :default => "v1.0" + property :featured, :protected => true + + validates_format_of :value, :with => /v\d+\.\d+/, :message => "of version is invalid", + :if => Proc.new { |r| r.name.to_sym == :version } + end + end + +On +account.save+ this will result in an error record being added. You can also inspect the +setting record using +account.settings.version_record+ + === Bulk operations Stored properties can also be updated with the update_attributes and update_attributes! methods by enabling nested attributes. Like this (from the test cases): \ No newline at end of file