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

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Hassan Schroeder at Jan 19, 2012 at 6:58 pm

    On Thu, Jan 19, 2012 at 10:23 AM, Dan King 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 Schroeder ------------------------ hassan.schroeder@gmail.com
    http://about.me/hassanschroeder
    twitter: @hassan

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jordan Miller at Jan 19, 2012 at 6:59 pm
    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 Jan 19, 2012, at 1:23 PM, Dan King 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?

    Thanks.

    -Dan

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Mohamad El-Husseini at Jan 19, 2012 at 7:01 pm
    Could it be that your first filter is preventing the request from reaching
    your second filter?

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/T2tkRsusNssJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 19, '12 at 6:23p
activeJan 19, '12 at 7:01p
posts4
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase