Multiple Before Filters

I’ve added two before filters in one of my controllers like so:

before_filter :filter_one
before_filter :filter_two

The first filter (:filter_one) always fires, but the second filter
(:filter_two) never does. Anyone know how to make both filters always
fire?

Thanks.

-Dan

what version of rails are you using? on 3.1.3 all three of these fire
fine for me in my application controller…

before_filter :must_login
before_filter :must_be_member
before_filter :must_be_admin

jordan

On Thu, Jan 19, 2012 at 10:23 AM, Dan K. [email protected] wrote:

I’ve added two before filters in one of my controllers like so:

before_filter :filter_one
before_filter :filter_two

The first filter (:filter_one) always fires, but the second filter
(:filter_two) never does. Anyone know how to make both filters always
fire?

That works fine for me, though I would probably just put both on the
same line, e.g.
before_filter :filter_one, :filter_two

Chances are your second filter is failing somehow; adding logging
statements might help track it down.


Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

Could it be that your first filter is preventing the request from
reaching
your second filter?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs