Flash Messages Helper: Rails Gem for displaying flash messages

Posted on JANUARY 19TH, 2010

I would like to announce the release of another gem over on Gemcutter .


The flash_messages_helper gem is a simple but configurable and well documented helper for displaying flash messages inside of your Ruby on Rails applications.

For full details see the readme over on github .

Sorry for being so breif. Ruby 1.9 and Rails 3 compatablily are next on the roadmap for all these gems. I have promissed screencasts of some these recently released gems in action following the compatibly milestones.


Gems Github Rails

Gravatar Image Tag: New features and bundled into a gem.

Posted on JANUARY 4TH, 2010

The Rails Gravatar Plugin has undergone a bunch of changes recently. Highlights for this 0.0.2 relase are as follows.


  • It is now bundled into a gem hosted over on Gemcutter. (Still works as a plugin also)
  • Support for pulling Gravatars off of a secure https server was added.
  • Support for using Gravatar ratings was added.
  • Support for specifying a file extension was added.

All the old and new features and usage is well documented in the projects README.


Gems Github Rails Ruby

Attribute Normalizer: Now also in ruby gem flavor

Posted on JANUARY 2ND, 2010
sudo gem install attribute_normalizer

The Attribute Normalizer rails plugin has been packaged up into a ruby gem hosted over at Gemcutter.


This release (0.1.1) also includes bug, feature, and documenation fixes.

I am looking for feedback on what I have planned for the 0.2 release of the gem/plugin.


Please take a look at the roadmap over on github and email me or drop a comment here with your feedback.

Mike D.


Active record Gems Github Rails Ruby

Ruby on Rails Flash Message View Helper

Posted on SEPTEMBER 28TH, 2009

I have been extracting and abstracting many of the components that I use across most of the Ruby on Rails applications that I work with and putting them up on GitHub as gems and Rails plugins. Here is another one (Flash Messages Helper) and I still have a lot more where these have been coming from.

Cheers, I hope you have a use for them.


I am in no way the first person to create a flash message plugin, but the other plugins that I did come across lacked any type of configuration or flexibility, so I ended up rolling my own.


./script/plugin install git://github.com/mdeering/flash_messages_helper.git

After installing the plugin you just need to replace your flash message calls with the following in your layout file.


The configuration points of the plugin include being able to change the id and class attriubtes of the elements along with the type of element that actually wraps your flash messages. See the full documentation over on the flash_messages_helper plugin page at GitHub

Example Usage

I like to add a class hideable to all flash messages and then use jQuery to allow the user to remove the flash message elements from the page if they like.

# config/initilizers/flash_messages_helper_settings.rb
ActionView::Base.flash_message_class_proc = lambda {|key| "#{key} hideable"}

Now all flash messages will come out with the class hideable. We can unobtrusively attach the hiding behavor to the element with the following jQuery.

  // Will add a link at the bottom of any element that is hiddable
  $.each($('.hideable'), function() {
    $(this).append('<a class="#">Hide</a>');

  // And this will actualy do the hiding of the parent element
  $('a.hide-link').click(function() {
    return false

Do me a quick favor if end up using some of my work. Take the time to Recommend me on Working With Rails , give me or one my repos a follow over on Github , follow me over on Twitter , or all of the above.


Github Rails

Ruby on Rails Gravatar Plugin

Posted on SEPTEMBER 23RD, 2009

Last week I got around to wrapping up my old Gravatar solution into an actual configurable Ruby on Rails plugin and hosting it over on GitHub .


Here is some example usage and configuration examples.

Install as you would any other plugin

./script/plugin install git://github.com/mdeering/gravatar_image_tag.git

Basic usage

gravatar_image_tag('spam@spam.com'.gsub('spam', 'mdeering'), :alt => 'Michael Deering')

Configuration Points

Change the default image to your own rather then using the one set by Gravitar

# config/initializers/gravatar_defaults.rb
ActionView::Base.default_gravatar_image  = 'assets.yourhost.com/images/default_gravatar.png'

Change the default (80px x 80px) size of the gravatars on your site.

# config/initializers/gravatar_defaults.rb
ActionView::Base.default_gravatar_size  = 120

Full usage and documentation is avalible in the gravatar_image_tag plugin repository on GitHub .


Github Gravatar Rails

Arrrr me bucko. Bringer along side for some booty

Posted on SEPTEMBER 17TH, 2009


Shiver me timbers. Saturday be International Speak Like A Pirate Day! It just so happens that I be doing a talk on metaprogramming that very same day at Edmonton Code Camp n’ I think I may have found a way t’ mix in a little pirate speak.

In hopes o’ helping out anyone else who may find themselves suprised by tha upcoming Speak Like A Pirate Day … I give ye The Booty Gem!


Install n’ run ahoy matey

gem sources -a gems.github.com
sudo gem install mdeering-booty
# We all require a little...
require 'booty'
msg =  'There was no question this was going to work as a singleton call.  All puns intended!'
Booty.call(msg) # => "There was nay question this was going t' brig as a singleton call.  All puns intended! surrender yer booty."


Gems Github

ActiveRecord Attribute Normalization (Rails Plugin)

Posted on SEPTEMBER 15TH, 2009

I like to keep my Active Record models as strict as possible. There are few things more enoying to me then having to deal with bad legacy data when a simple change to a database column to not allow NULL values or adding validation in a model to disalow ’’ could have saved hours of data massaging.

Enter the attribute_normalizer rails plugin

class Klass < ActiveRecord::Base
  # Can take an array of attributes if you want
  normalize_attributes :first_name, :last_name
object = Klass.new
# Blank normalizes to nil
object.first_name = ''
object.first_name # => nil

# Whitespace is also cleaned up 
object.last_name = "\tDeering\n"
object.last_name # => 'Deering'

And for more bonus points then I can throw at it also accepts blocks!

class Klass < ActiveRecord::Base
  normalize_attributes :home_phone_number, :office_phone_number_ do |value|
    return nil unless value.is_a?(String)
    value.gsub(/\W/, '').gsub(/^1/, '')

  normalize_attributes :postal_code do |value|
object = Klass.new
# Your given block will be executed to normalize
object.home_phone_number = '+1 (555) 123.4567'
object.home_phone_number # => '5551234567'

# Normalization happens before any validations.
# This will surely help avoid a lot of regex within validates_format_of
object.postal_code = 't6m 2x2'
object.postal_code # => 'T6M2X2'

This has become standard on every one of my rails projects. I hope you can find a use for it also. I have some backend Ruby work coming up so I should get around to making this a gem soon.

Mike D.

I’m on Twitter


Active record Github Rails

Available For Hire

Contact Me

Michael Deering mdeeirng.com Cell: 780.906.6632


" Michael understands what is means in business to abide by timelines and budget. His great work ethic and agile perspective allow him to motivate and manage himself, and his team, seemingly without effort. He has a great attitude and enjoys sinking his teeth into projects that leverage and push his skill set to the limit. "
Erik Lagerway / Co-Founder & CEO / Gaboogie

" Michael's attention to detail and intense interest in continuously improving the software development process made working with him a very enjoyable experience. Michael was a great manager to work with during my time at Lypp. In addition he was an excellent software developer that set a high standard for others to meet. I would definitely work with Michael again in the future. "
Dan Kubb / Ruby Hero

" Mike is a very sharp technologist with an eye for simplicity. He is able to break down complex concepts into elegant solutions and communicate them effectively with a remote team. Mike's leadership is apparent by his ability to manage scope, keep deadlines and translate evolving business requirements into flexible technical solutions. "
Jason Cartwright / CTO / Cogwise Software

Post Categories

Active record Active record Active resource Asset packager Blog Capistrano Css Gems Github Google Gravatar Gravitar Haml Javascript Lypp Mac Outlook Paperclip Parallels Rails Rake Ruby Rubyconf Sass Skype Textmate Twitter Windows
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.