ruby on rails - get a reference to a class to output meta information of calling class -


I am debugging some callbacks in my ActiveRecord models. I would like to have a globally available method like the following:

  logger.info ("ITEM Calling Check_States")  

But I Want a normal version that I can add to a model class I was thinking about Monkey Bar Active Activecore recording: Like the following in the base initializers / my_initializer.rb:

  class ActiveRecord :: Base # This work is done at end_log_proof logger.info (" Logger.com ("# {klass.name})" at the end of the End Def FIF Log () ("# {klass.name}}") Logger.com ("Calling # {Class.__ Method __} .pack # {klass .__ FILE__} line upcase: # {class____ LINE__} ") Ending  

And if I call like this:

  class items & lt; ActiveRecord :: Base after_save: my_callback def my_callback end_log_proof # this works end_log (auto) # ouptuts: "calling MY_CALLBACK at ...." end  

failed with another:

  No mathrier error (undefined method 'name' for item # and lefthinum;):  

I'm trying to get a reference for the calling context Am - how woudl i get it to work?

thx


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -