@madpilot makes

Ruby on Rails validator plugin for password fields

I’m working on a site that allows users to create password protected accounts (Pretty much like every other website around) and I needed a way to check that the password field and confirm password field were the same.

I saw this as an opportunity to play with plug ins :)

You can download the validates_equality_of plug here.

Instructions for use:

  1. Untar the file into the plugins directory of your rails application
  2. You now have access to the validates_equality_of method

Easy!

The method is called in the following manner (assuming you have fields called password and confirm_password)

validates_equality_of :password, :with => :confirm_password

You can override the message in the usual way by supplying a :message attribute.

Hope someone find it useful.

2 comments

  1. Did you miss out on validates_confirmation_of or am I utterly confuddled?
  2. Yep! I did... Thanks for letting me know about that method. I still I got to play with plugins, so not all is lost :)

Leave a comment