How does Rails implement filters?

Hi,

I got to thinking this morning about filters and how they are actually
implemented. If I was gonna implement it, I’d be tempted to do
something like this:

class Base

def perform_action
action_name
if self.class.responds_to?(action_name)
run_before_filters
run_around_filters { send(action_name) }
run_after_filters
else
# do other things
end
end

end

Now I see something like that in action_controller/base.rb, but I see
no mention of filters. It just calls send(action_name). Where do the
filters come in?

Thanks,
Ryan

On 17 Jul 2008, at 13:28, Ryan wrote:

Now I see something like that in action_controller/base.rb, but I see
no mention of filters. It just calls send(action_name). Where do the
filters come in?

Look in filters.rb
It aliases perform_action

Fred

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