Permalink
Browse files

Improved Readme

  • Loading branch information...
1 parent c9d81c9 commit 479ebcf2bea535eb8a41ba4173a4809ac64bd948 @joelmoss joelmoss committed Aug 9, 2010
Showing with 55 additions and 13 deletions.
  1. +0 −13 README
  2. +55 −0 README.md
View
13 README
@@ -1,13 +0,0 @@
-DynamicForm
-===========
-
-DynamicForm holds a few helpers method to help you deal with your models, they are:
-
-* input(record, method, options = {})
-* form(record, options = {})
-* error_message_on(object, method, options={})
-* error_messages_for(record, options={})
-
-It also adds f.error_messages and f.error_messages_on to your form builders.
-
-Copyright (c) 2010 David Heinemeier Hansson, released under the MIT license
View
@@ -0,0 +1,55 @@
+DynamicForm
+===========
+
+DynamicForm holds a few helpers method to help you deal with your Rails3 models, they are:
+
+* `input(record, method, options = {})`
+* `form(record, options = {})`
+* `error_message_on(object, method, options={})`
+* `error_messages_for(record, options={})`
+
+It also adds `f.error_messages` and `f.error_messages_on` to your form builders.
+
+---
+
+DynamicErrors
+=============
+
+DynamicForm also includes DynamicErrors, which is a port of the custom-err-messages plugin,
+but built to work with Rails3. It gives you the option to not have your custom validation
+error message prefixed with the attribute name. Ordinarily, if you have, say:
+
+ validates_acceptance_of :accepted_terms, :message => 'Please accept the terms of service'
+
+You'll get the following error message:
+
+ Accepted terms Please accept the terms of service
+
+This plugin allows you to omit the attribute name for specific messages. All you have to do
+is begin the message with a '^' character. Example:
+
+ validates_acceptance_of :accepted_terms, :message => '^Please accept the terms of service'
+
+Nigel Ramsay added the ability to specify a proc to generate the message.
+
+ validates_presence_of :assessment_answer_option_id,
+ :message => Proc.new { |aa| "#{aa.label} (#{aa.group_label}) is required" }
+
+ which gives an error message like: Rate (Accuracy) is required
+
+---
+
+Installation
+------------
+
+DynamicForm can be installed as a gem in your `Gemfile`:
+
+ gem 'dynamic_form'
+
+or as a plugin by running this command:
+
+ rails plugin install git://codaset.com/joelmoss/dynamic-form.git
+
+---
+
+Copyright (c) 2010 David Heinemeier Hansson, released under the MIT license

0 comments on commit 479ebcf

Please sign in to comment.