Flash Message Conductor
A simple pattern for managing flash messages in your Ruby on Rails application.
Installation
This branch is only used for Rails 3. Still using Rails 2? Use https://github.com/planetargon/flash-message-conductor/tree/rails2 instead.
Add this line to your application's Gemfile:
gem "flash-message-conductor", "~> 2.0.1"
And then execute:
$ bundle
Or install it yourself as:
gem install flash--conductor
Usage
Controller helpers
('foo')
Is the equivalent of:
flash[:message] = 'foo'
Rails Controller helpers included:
()
add_notice()
add_error()
add_alert()
View helpers
<%= render_flash_messages %>
Produces:
<div id="flash_messages">
<p class="message">You have successfully done XYZ...</p>
</div>
Or... if you set an error:
<div id="flash_messages">
<p class="error">Oops! Something went bonkers!<p>
</div>
Or:
<% if flash_message_set? -%>
# do something
<% end -%>
Copyright (c) 2008-2013 Planet Argon, released under the MIT license
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request