README.rdoc in message_block-1.0.3 vs README.rdoc in message_block-1.0.4

- old
+ new

@@ -31,20 +31,21 @@ a basic stylesheet installed at public/stylesheets/message_block.css. Then you can use the helper <tt><%= message_block %></tt>: The first argument specifies a hash options: -* <tt>:on</tt> - specifies one or many model names for which to check error messages. +* <tt>:on</tt> - specifies one or many model names for which to check error messages. You can specify the special value of :all which will grab all view assignments that contain an ActiveModel "errors" method. * <tt>:model_error_type</tt> - specifies the message type to use for validation errors; defaults to 'error' * <tt>:flash_types</tt> - specifies the keys to check in the flash hash. Messages will be grouped in ul lists according to this type. Defaults to: %w(back confirm error info warn) * <tt>:html</tt> - Specifies HTML options for the containing div * <tt>:id</tt> - Specifies ID of the containing div; defaults to 'message_block' * <tt>:class</tt> - Specifies class name of the containing div; defaults to nothing. * <tt>:container</tt> - specifies which block-level element to contain the errors (defaults to :div). === Example + Imagine you have a form for entering a user and a comment: <%= message_block :on => [:user, :comment] %> Imagine also you set these flash variables in the controller: @@ -72,10 +73,12 @@ <li>Warn A</li> <li>Warn B</li> </ul> </div> +Note that instead of manually specifying models you wish to report errors on, you can instead use the special <tt>:all</tt> value which will automatically use all view assign values that contain an ActiveModel::Errors "errors" method. + === Ajax & JavaScript Integration Sometimes you'll want to use the message block pattern within JavaScript. Wouldn't it be nice to just populate the message_block DOM tree based on a JavaScript object not unlike Rails flash? @@ -126,6 +129,6 @@ onSuccess: function(transport) { this.message_block.clear(); // Do something... } - }); \ No newline at end of file + });