Created
March 13, 2009 05:16
-
-
Save dnch/78442 to your computer and use it in GitHub Desktop.
This file contains 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
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.1/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant ActiveRecord::Validations (NameError) | |
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.1/lib/active_support/dependencies.rb:80:in `const_missing' | |
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.1/lib/active_record/base.rb:3140 | |
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.1/lib/active_record/base.rb:3138:in `class_eval' | |
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.1/lib/active_record/base.rb:3138 | |
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.1/lib/active_record/validations.rb:9 | |
from ./lib/money_handler.rb:19:in `enable' | |
from ./lib/money_handler.rb:26 | |
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' | |
... 10 levels... | |
from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/example_group_runner.rb:14:in `load_files' | |
from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/options.rb:94:in `run_examples' | |
from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib/spec/runner/command_line.rb:9:in `run' | |
from /Library/Ruby/Gems/1.8/gems/rspec-1.1.12/bin/spec:4 |
This file contains 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
require 'rubygems' | |
require 'active_record' | |
require 'active_support' | |
# punch the duck | |
module MoneyHandler | |
module Validations | |
module ClassMethods | |
def validate_local_numericality_of(*args) | |
false | |
end | |
end | |
end | |
class << self | |
def enable | |
ActiveRecord::Validations::ClassMethods.send :include, MoneyHandler::Validations::ClassMethods | |
end | |
end | |
end | |
if defined?(ActiveRecord) && defined?(ActiveRecord::Validations) | |
MoneyHandler.enable | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment