Guest User

Untitled

a guest
Aug 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. module CachingPlugin
  2. def self.included(base)
  3. base.send :extend, ClassMethods
  4. end
  5. module ClassMethods
  6. def smart_cache(id, name)
  7. klass = self.class.to_s # This is evaluating to "Class" where I'm expecting "User"
  8. obj = Object.const_get(klass).find(id)
  9. obj.do_caching(name)
  10. end
  11. end
  12. module InstanceMethods
  13. def do_caching(name)
  14. # caches self.values
  15. end
  16. end
  17. end
Add Comment
Please, Sign In to add comment