Lambda (or Proc) support in validation messages #411

Merged
1 commit merged into from Feb 16, 2011

1 participant

@francocatena

I added lambda support to the size and content type validator, so now you can do something like:

validates_attachment_size :avatar, :less_than => 2.megabytes, :message => lambda { I18n.t('invalid_image_size') }

This is consistent with Rails validators, wich receive either a String or a Proc.

Regards.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment