Created
May 28, 2009 23:17
-
-
Save edavis10/119654 to your computer and use it in GitHub Desktop.
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
### init.rb | |
require 'dispatcher' | |
Dispatcher.to_prepare do | |
require 'my_moo_patch' | |
Journal.send(:include, ObserverJournalPatch) | |
end | |
### lib/observer_journal_patch.rb | |
require_dependency 'journal' | |
module ObserverJournalPatch | |
def self.included(base) # :nodoc: | |
base.extend(ClassMethods) | |
base.send(:include, InstanceMethods) | |
base.class_eval do | |
unloadable # Send unloadable so it will not be unloaded in development | |
before_save :check_thing | |
end | |
end | |
module ClassMethods | |
end | |
module InstanceMethods | |
def check_thing | |
return false | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment