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.

no callbacks should be created for empty only option

#5289

Callback module creates all callbacks if empty array is provided for only option.
example.

define_model_callbacks :empty, :only => []

creates all three after, before,around filters.
this patch fixes this issue.

Reported by Subba · August 3rd, 2010 @ 10:12 PM

State: resolved
Milestone: 3.x
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. Subba
    Subba
    • Assigned user changed from Santiago Pastorino to José Valim

    August 4th, 2010 @ 07:39 PM

  2. José Valim
    José Valim
    • Importance changed from to Low

    Why would you pass :only => []?

    August 4th, 2010 @ 07:44 PM

  3. Subba
    Subba

    what if some meta programming construct creates empty array. you don't want it to create callbacks.

    August 4th, 2010 @ 08:09 PM

  4. José Valim
    José Valim
    • State changed from new to invalid

    If this is the case, I would prefer to raise an error. It makes no sense such construct and I can't see a reason to be worried about such special case.

    August 4th, 2010 @ 08:16 PM

  5. Subba
    Subba

    do you want me to change the patch to raise an error. or leave the code in current form.

    August 4th, 2010 @ 08:20 PM

  6. José Valim
    José Valim
    • State changed from invalid to new
    • Milestone set to 3.x

    Sorry, I marked it as invalid by mistake. I will actually apply the current patch since raising an error would just add even more lines of code. :) Thanks!

    August 4th, 2010 @ 08:25 PM

  7. Repository