README.md in signed_form-0.2.0 vs README.md in signed_form-0.5.0

- old
+ new

@@ -2,10 +2,11 @@ [![Gem Version](https://badge.fury.io/rb/signed_form.png)](http://badge.fury.io/rb/signed_form) [![Build Status](https://travis-ci.org/erichmenge/signed_form.png?branch=master)](https://travis-ci.org/erichmenge/signed_form) [![Code Climate](https://codeclimate.com/github/erichmenge/signed_form.png)](https://codeclimate.com/github/erichmenge/signed_form) [![Coverage Status](https://coveralls.io/repos/erichmenge/signed_form/badge.png?branch=master)](https://coveralls.io/r/erichmenge/signed_form) +[![Inline docs](http://inch-ci.org/github/erichmenge/signed_form.svg?branch=master&style=flat)](https://inch-ci.org/github/erichmenge/signed_form) SignedForm brings new convenience and security to your Rails 4 or Rails 3 application. SignedForm is under active development. Please make sure you're reading the README associated with the version of SignedForm you're using. Click the tag link on GitHub to switch to the version you've installed to get the correct @@ -46,15 +47,30 @@ @user.update_attributes params[:user] end end ``` +Disabled fields need to be explicitly signed: + +```erb +<%= form_for @user, signed: true do |f| %> +<% f.add_signed_fields :name %> + +<%= f.text_field :name, disabled: true %> +<%= f.submit %> +<% end %> +``` + That's it. You're done. Need to add a field? Pop it in the form. You don't need to then update a list of attributes. Of course, you're free to continue using the standard `form_for`. `SignedForm` is strictly opt-in. It won't change the way you use standard forms. +## Is it any good? + +Yes. + ## More than just Convenience - Security SignedForm protects you in 3 ways: * Form fields are signed, so no alteration of the fields are allowed. @@ -98,11 +114,11 @@ # ... end ``` -You'll also need to create an initializer: +On Rails versions older than 4.1, you'll also need to create an initializer: ```shell $ echo "SignedForm.secret_key = '$(rake secret)'" > config/initializers/signed_form.rb ``` @@ -114,11 +130,11 @@ Any form that wraps `form_for` and the default field helpers will work with SignedForm. For example, a signed SimpleForm might look like this: ```erb <%= simple_form_for @user, signed: true do |f| %> - f.input :name + <%= f.input :name %> <% end %> ``` This will create a signed form as expected. @@ -140,9 +156,13 @@ ```erb <%= form_for @user, signed: true, builder: MyAdapter do |f| %> <%= f.some_helper :name %> <% end %> ``` + +## ActiveAdmin support + +Gem [`signed_form-activeadmin`](https://github.com/cschramm/signed_form-activeadmin) integrates SignedForm with Active Admin. ## Form Digests SignedForm will create a digest of all the views/partials involved with rendering your form. If the form is modifed old forms will be expired. This is done to eliminate the possibility of old forms coming back to bite you.