This project is archived and is in readonly mode.

#1627 ✓resolved
L. Caviola

Allow multiple conditions for callbacks

Reported by L. Caviola | December 24th, 2008 @ 01:37 PM

This patch makes it possible to use :if and :unless together when using callbacks and allows you to add multiple conditions as an array.

Example:


  before_validation :set_random_user, :unless => :user, :if => :beginning
  validate :validates_user, :if => [:user, :beginning]

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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Referenced by

Pages