This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Jack Chen (author)
Sun Sep 07 20:23:58 -0700 2008
| name | age | message | |
|---|---|---|---|
| |
CHANGELOG | Sun Sep 07 20:23:58 -0700 2008 | |
| |
MIT-LICENSE | Sun Sep 07 20:23:58 -0700 2008 | |
| |
README | Sun Sep 07 20:23:58 -0700 2008 | |
| |
Rakefile | Sun Sep 07 20:23:58 -0700 2008 | |
| |
init.rb | Sun Sep 07 20:23:58 -0700 2008 | |
| |
install.rb | Sun Sep 07 20:23:58 -0700 2008 | |
| |
lib/ | Sun Sep 07 20:23:58 -0700 2008 | |
| |
tasks/ | Sun Sep 07 20:23:58 -0700 2008 | |
| |
test/ | Sun Sep 07 20:23:58 -0700 2008 | |
| |
uninstall.rb | Sun Sep 07 20:23:58 -0700 2008 |
README
priority_filter ============== priority_filter is an extension of filters in Rails that allows you to set priorities to filters. The main benefit of this is you can now have a filter defined in a parent controller that gets executed after the same type of filter in a child controller. It does this by overriding all the *_filter methods and storing them in an array, and then rebuilding the filter chain whenever a filter is added or skipped. This causes a longer loading time, but it only has to do this when the controller is loaded, so after the application loads, there is no performance hit (that I can see). A more elegant solution would to be override the find_filter_append/prepend_position, but it wasn't working for me so I gave up and went with this method. Usage ===== All the *_filter methods now accept :priority as an option. :priority can be any positive integer, or :first (which gets changed to 0) or :last (will always be called after all other filters that are also not :last). Leaving out :priority sets the priority to 1. So if you install this plugin into an existing project, it (theoretically) will not change the filter execution order. prepend_*_filter simply implies :first. before_filter :filter, :priority => 5 after_filter :after, :priority => :last Example ======= class ApplicationController < ActionController::Base before_filter :foo, :priority => 5 before_filter :bar, :priority => :first end class FooController < ApplicationController before_filter :rah, :priority => 3 before_filter :moo, :priority => :first end class BarController < FooController before_filter :kek before_filter :bah, :priority => :last end Filter priorities (in execution order): :bar => 0 :moo => 0 :kek => 1 :rah => 3 :foo => 5 :bah => last Copyright (c) 2008 Jack Chen, under the MIT License








