Skip to content

Instantly share code, notes, and snippets.

@benders
Created July 10, 2009 06:31
Show Gist options
  • Save benders/144279 to your computer and use it in GitHub Desktop.
Save benders/144279 to your computer and use it in GitHub Desktop.
Use New Relic add_method_tracer with Class methods
class Product < ActiveRecord::Base
class << self
# Define a public instance method on the singleton Class named Product
def get_recommended_for_subscriber(subscriber)
# ... call some web service, then use find to return a product instance ...
end
add_method_tracer :get_recommended_for_subscriber, 'Custom/Product.get_recommended_for_subscriber'
end
# Instance methods of Product go here
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment