Created
October 29, 2011 04:16
-
-
Save nilbus/1324063 to your computer and use it in GitHub Desktop.
This initializer would replace all the modifications to the controllers
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
# No need to require aquarium; adding aquarium to the Gemfile takes care of that | |
class ActionController::Base | |
include Aquarium::DSL | |
around :methods => :all do |join_point, object, *args| | |
logger.info "[info] Entering: #{join_point.target_type.name}##{join_point.method_name}: object = #{object}, args = #{args}" | |
result = join_point.proceed | |
logger.info "[info] Leaving: #{join_point.target_type.name}##{join_point.method_name}: object = #{object}, args = #{args}" | |
result # block needs to return the result of the "proceed"! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:methods => :all does public methods only by default (the actions), which is exactly what we want.