Created
January 11, 2012 13:12
-
-
Save nthx/1594592 to your computer and use it in GitHub Desktop.
DRY anti 1
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
#example of BAD code duplication among 2 controllers | |
#that could be at least extracted to 1 base controller | |
#and /:show game.name/ should be used | |
class A::Controller | |
before_filter :check_perms | |
def set_points | |
player.set_points params[:points] | |
redirect_to :action => :index | |
end | |
def reset_questions | |
game.reset_questions | |
redirect_to :action => :show 'battlefield3' | |
end | |
end | |
class B::Controller | |
before_filter :check_perms | |
def set_points | |
player.set_points params[:points] | |
redirect_to :action => :index | |
end | |
def reset_questions | |
game.reset_questions | |
redirect_to :action => :show 'mw3' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment