This project is archived and is in readonly mode.

#4057 ✓resolved
Sven Fuchs

Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options hash and make various Validators pass their options

Reported by Sven Fuchs | February 25th, 2010 @ 08:00 PM | in 3.0.2

Current ActiveModel Validators do not pass their options hash to Errors#add. This makes it hard for plugin authors to add arbitrary options to, e.g. a call like validates_presence_of :format => "some format".

Also, there's still that confusion of :default vs :message options that never could be cleaned up due to BC concerns since 2.2.x

I've tried to clean these things up and relax Validator message generation by passing their (filtered) options hash (i.e. options like :allow_nil will not be passed to the errors collection)

Here's the commit on my fork:

I'll also attach the commit formatted as a patch.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>