An open API service indexing awesome lists of open source software.

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

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