Created
October 18, 2012 21:26
-
-
Save kneath/3914835 to your computer and use it in GitHub Desktop.
Given a controller in need of refactoring into multiple controllers, how can I redirect to new controller actions based upon a feature flag?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a controller in need of refactoring into multiple controllers, how | |
# can I redirect to new controller actions based upon a feature flag? | |
# | |
# The current code "works" but doesn't exercise the controller action. | |
# | |
# Rails 2.3 or 3.0 methods accepted | |
class BetterController | |
def overview | |
# .. a small amount of auth/permissions code | |
end | |
end | |
class PoorlyNamedController | |
def show | |
if feature_flag? | |
render :template => 'better/overview', :layout => 'new_layout' | |
return | |
end | |
# ... tons of code here in a horrible method that needs to be split | |
# into multiple methods across many controllers | |
end | |
end |
joeyw
commented
Oct 19, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment