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.

Skip before filters do not merge when subclassing

#4761

In the below scenario, we have a Core::FooController that defines some actions and also provides a skip before filter for one of his actions. Later we extend the Core::FooController and create the Enhanced::FooController and he has actions that are not part of the core but need to also skip the same before filter (such as login). When you try to access action_a through the Extended controller, the skip before filter is ignored. I would think that when the subclass provides a skip before filter it would merge in the parent classes definition as well. Otherwise you have to put the skip before filter defined in the core in every sublcass.

class ApplicationController
def method_a end end

class Core::FooController < ApplicationController
skip_before_filter :method_a, :only => [:action_a]

def action_a end end

class Enhanced::FooController < Core::FooController
skip_before_filter :method_a, :only => [:action_b]

def action_b end end

Reported by Jake Dempsey · June 3rd, 2010 @ 04:39 PM

State: resolved
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: none

Activity

  1. Rohit Arondekar
  2. José Valim
    José Valim
    • Milestone cleared.
    • State changed from new to open
    • Assigned user changed from José Valim to Yehuda Katz (wycats)

    Planning to pair with Mr. Katz on it today and make it shine!

    June 11th, 2010 @ 10:43 AM

  3. Piotr Sarnacki
    Piotr Sarnacki

    Have you worked on it already?

    I tried to reproduce it on edge and it seems to work perfectly.

    June 21st, 2010 @ 01:05 PM

  4. Repository
    Repository
    • State changed from open to resolved

    (from [02399a1184d0f87b14af461fab731120d92c5ad8]) Ensure overwritten callbacks conditions in controllers work [#4761 state:resolved] [#3913 state:resolved] http://github.com/rails/rails/commit/02399a1184d0f87b14af461fab7311...

    June 22nd, 2010 @ 06:58 AM

  5. José Valim
    José Valim
    • Assigned user changed from Yehuda Katz (wycats) to José Valim

    June 22nd, 2010 @ 01:39 PM

  6. Jeremy Kemper