Guest User

Untitled

a guest
Jun 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. ## Presently, the method I use:
  2.  
  3. def self.handle_old( record )
  4.  
  5. if record.update_tracker < -1
  6. #record.delete
  7. print "bang bang! I deleted #{record.name} at id #{record.id}. I killed it good, pa!\n"
  8. end
  9.  
  10. return 0
  11. end
  12.  
  13. ## Error message with alias
  14.  
  15. alias :handle_old :handle_old_del
  16.  
  17. >> LocalAccount.first
  18. NameError: undefined method `handle_old_del' for class `LocalAccount'
  19. from /srv/www/htdocs/usrsys/app/models/local_account.rb:135
  20. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_without_new_constant_marking'
  21. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:380:in `load_file'
  22. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
  23. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:379:in `load_file'
  24. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:259:in `require_or_load'
  25. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:425:in `load_missing_constant'
  26. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing'
  27. from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing'
  28. from (irb):147
  29.  
  30.  
  31. ## class / extend module looks like:
  32.  
  33. class LocalAccount < Account
  34. extend UsrsysSuper
  35.  
  36. ## Inside my UsrsysSuper module
  37.  
  38. module UsrsysSuper
  39.  
  40. def set_hooks( ids_to_hook )
  41.  
  42.  
  43. return 0
  44. end
  45.  
  46. def find_or_create( )
  47.  
  48. return 0
  49. end
  50.  
  51. def handle_old( obj = nil )
  52.  
  53. return 0
  54. end
  55.  
  56. def handle_old_del( record )
  57.  
  58. if record.update_tracker < -1
  59. #record.delete
  60. print "bang bang! I deleted #{record.name} at id #{record.id}. I killed it good, pa!\n"
  61. end
  62.  
  63. return 0
  64. end
  65.  
  66. end # end module UsrsysSuper
Add Comment
Please, Sign In to add comment