Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created April 9, 2010 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floehopper/361028 to your computer and use it in GitHub Desktop.
Save floehopper/361028 to your computer and use it in GitHub Desktop.
# example 1
class WidgetsController < ApplicationController
before_filter :filter_1, :only => [:action_1, :action_2]
before_filter :filter_2, :only => [:action_2, :action_3]
before_filter :filter_3, :only => [:action_1, :action_3]
def action_1
# code
end
def action_2
# code
end
def action_3
# code
end
end
# example 2
class WidgetsController < ApplicationController
def action_1
filter_1
filter_3
# code
end
def action_2
filter_1
filter_2
# code
end
def action_3
filter_2
filter_3
# code
end
end
# example 3
class WidgetsController < ApplicationController
before_filters :filter_1, :filter_3
def action_1
# code
end
before_filters :filter_1, :filter_2
def action_2
# code
end
before_filters :filter_2, :filter_3
def action_3
# code
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment