Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. # Define Proc object as an argument for `set_trace_func`
  2. set_trace_func lambda { |event, file, line, id, binding, klass|
  3. # Select `call` type events
  4. if event == 'call'
  5. # Your console would be filled with a lot of method call logs without any filter...
  6. if file.include?('active_record') || file.include?('active_model')
  7. puts "#{file}:#{line}"
  8. p klass, id
  9. puts ''
  10. end
  11. end
  12. }
  13.  
  14. # And, you can call any method
  15. #
  16. # ex) Article.first.title
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement