Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Allow multiple conditions for callbacks

#1627

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]

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

State: resolved
Milestone: none
Assigned to: josh josh
Importance: none

Activity

  1. L. Caviola
    L. Caviola
    • Tag changed from activesupport, callback, improvement to activesupport, callback, improvement, patch, tested

    A nicer way to do this (thanks to fcheung)

    December 24th, 2008 @ 02:44 PM

  2. Pratik
    Pratik
    • Assigned user set to josh

    December 28th, 2008 @ 04:09 PM

  3. josh
    josh
    • Milestone cleared.
    • State changed from new to open

    December 28th, 2008 @ 08:58 PM

  4. Repository
    Repository
    • State changed from open to resolved

    (from [1e45818a622405e720a4529795f8be2f11660361]) Allow multiple conditions for callbacks [#1627 Allow multiple conditions for callbacks state:resolved] http://github.com/rails/rails/co...

    December 28th, 2008 @ 09:14 PM