Skip to content

Instantly share code, notes, and snippets.

@edavis10
Created May 28, 2009 23:17
Show Gist options
  • Save edavis10/119654 to your computer and use it in GitHub Desktop.
Save edavis10/119654 to your computer and use it in GitHub Desktop.
### 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