Permalink
Browse files

Rails 3.2.2 compatiblity.

One of our reference data types has a code of VALID, which was
generating a valid? method that overwrote ActiveRecord's version. By
telling ActiveRecord we don't need validations when pulling over data
from the development environment, we side step that issue.

I still need to figure out what the proper behavior is for cases like
this. Perhaps throw an exception.
  • Loading branch information...
1 parent afa00dc commit 0bc3c1e7ba36cdb2a1d552335e4c5bfd45a70cfc @dougbarth dougbarth committed Mar 15, 2012
Showing with 1 addition and 2 deletions.
  1. +1 −2 lib/tasks/acts_as_reference_data_tasks.rake
@@ -11,7 +11,6 @@ task :load_reference_data => :environment do
dev_ref_data_class = Class.new(ref_data_class)
dev_ref_data_class.const_set("Dev", dev_ref_data_class)
dev_ref_data_class.class_eval do
- set_table_name ref_data_class.table_name.sub(/.*\./, '')
establish_connection(:development)
end
@@ -27,7 +26,7 @@ task :load_reference_data => :environment do
ref_data = ref_data_class.new(attributes)
ref_data.id = ActiveRecord::Fixtures.identify(attributes['code'])
- ref_data.save!
+ ref_data.save!(:validate => false)
end
end
end

0 comments on commit 0bc3c1e

Please sign in to comment.