Skip to content

Instantly share code, notes, and snippets.

@nilbus
Created October 29, 2011 04:16
Show Gist options
  • Select an option

  • Save nilbus/1324063 to your computer and use it in GitHub Desktop.

Select an option

Save nilbus/1324063 to your computer and use it in GitHub Desktop.
This initializer would replace all the modifications to the controllers
# 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
@nilbus

nilbus commented Oct 29, 2011

Copy link
Copy Markdown
Author

:methods => :all does public methods only by default (the actions), which is exactly what we want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment