README.rdoc in property_sets-0.0.6 vs README.rdoc in property_sets-0.0.7
- old
+ new
@@ -25,40 +25,19 @@
account.settings.ssl=(value) # immediately changes the value of the setting
account.settings.ssl? # coerces the setting to boolean AR style
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.
+Stored properties can also be updated with the update_attributes and update_attributes! methods by
+enabling nested attributes. See the test cases for examples.
- # Assuming params include { :account => { :settings => { :version => "v2.0", :forums => '0' }}}
- # the below would set the respective values on the account
- account.update_attributes(params[:account])
-
-We also created a view helper to help you generate the UI for enabling and disabling properties:
-
- <% form_for(:account, :html => { :method => :put }) do |f| %>
- <h3>
- <%= f.property_set_check_box(:settings) :forums %> Enable forums on your account
- </h3>
- <% end %>
-
-== Security
-
-We support protection from mass updates, the syntax is as follows:
-
- class Account < ActiveRecord::Base
- property_set :settings do
- property :product, :protected => true
- end
- end
-
== Installation
Install the gem in your rails project by putting it in your Gemfile:
gem 'property_set'
-Also remember to create the storage table, if for example you are going to be using this with an accounts model and have, you can should the table like:
+Also remember to create the storage table, if for example you are going to be using this with an accounts model, you can define the table like:
create_table :account_settings do |t|
t.integer :account_id, :null => false
t.string :name, :null => false
t.string :value
\ No newline at end of file