Created
April 19, 2012 08:37
-
-
Save flooose/2419708 to your computer and use it in GitHub Desktop.
Module with dynamic method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module RedisSupport | |
| after_save :load_into_redis | |
| before_destroy :remove_from_redis | |
| def self.included(base) | |
| unless base.respond_to? :load_into_redis | |
| raise(Exception.new, "Please define the methods \"load_into_redis\" before including this module") | |
| end | |
| end | |
| # This method needs to be customize for each model | |
| def load_into_redis | |
| end | |
| def remove_from_redis | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment