Skip to content

Instantly share code, notes, and snippets.

@mikeymicrophone
Created August 15, 2014 15:28
Show Gist options
  • Save mikeymicrophone/456e8b5e4c03a5ff2a9c to your computer and use it in GitHub Desktop.
Save mikeymicrophone/456e8b5e4c03a5ff2a9c to your computer and use it in GitHub Desktop.
trying to execute __FILE__ on a different file using inheritance and callbacks in Ruby 1.8.7
class ApplicationController
#logs of code omitted
before_filter :define_file_locator
def define_file_locator
self.class.send :define_method, :log_file_location, lambda {
instance_eval 'Rails.logger.info "File location: #{__FILE__}"'
}
log_file_location
end
end
@mikeymicrophone
Copy link
Author

this isn't gonna work. it was kind of a shot in the dark. I wonder if Rubinius would do any better

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