Can I change the order for before_filter's between applicati

Hi,

Can I change the order for before_filter’s between application.rb
filters &
another filters from another controller that inherits from
“ApplicationController” ???

For example I have 3 before_filters in application.rb, and these seem to
be
handled before the before_filter that I have in another specific
controller
that inherits from ApplicationController (in this particular case the
specific controller is part of a plugin, hence is in the vendor
directory).
I really want the plugin vendors controller before_filter to fire before
the
ones in the application.rb.

Tks

never used it, but rails docs got this:

prepend_before_filter :yourfilteraction

from the docs:
"Using before_filter and after_filter appends the specified filters to
the existing chain. That’s usually just fine, but some times you care
more about the order in which the filters are executed. When that’s
the case, you can use prepend_before_filter and prepend_after_filter.
Filters added by these methods will be put at the beginning of their
respective chain and executed before the rest. For example: "

maybe that works, not sure though.

Tks - this worked - wonder what would happen however if you had multiple
plugins, including vendor plugins. How would you control the order
then?

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