https://github.com/dbackowski/error_messages_for_helper
Rails 3.2.x error_messages_for plugin
https://github.com/dbackowski/error_messages_for_helper
Last synced: 12 months ago
JSON representation
Rails 3.2.x error_messages_for plugin
- Host: GitHub
- URL: https://github.com/dbackowski/error_messages_for_helper
- Owner: dbackowski
- License: mit
- Created: 2011-08-29T13:17:33.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2014-02-06T09:54:06.000Z (over 12 years ago)
- Last Synced: 2024-12-29T12:40:47.154Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 146 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# ErrorMessagesForHelper #
Rails 3.2.x error_messages_for_helper plugin.
### Example ###
```ruby
<%= form_for :test, :url => {:action => 'create'}, :html => {:method => :post} do |f| %>
<%= error_messages_for :test %>
<%= f.text_field :name %>
<%= f.text_field :age %>
<% end %>
```
When @test.errors is not empty error_messages_for will output:
```html
Unable to save data.
Errors list:
- Can't be empty
- Must be integer
-
```
### Customize ###
For custom messages in your locale put this section:
```ruby
error_messages_for:
header_message: 'Unable to save data.'
error_list: 'Errors list:'
```
You can set global CSS class by html_options:
```ruby
ErrorMessagesForHelper.html_options(:class => 'alert alert-error')
```
output:
```html
Unable to save data.
Errors list:
- Can't be empty
- Must be integer
-
```
Copyright (c) 2012 [Damian Baćkowski], released under the MIT license