Skip to content
Browse files

Some AR 3.1 fixes, seems database cleaner is imcompatible yet though...

  • Loading branch information...
1 parent daf53b0 commit 80e6aad47c1bc2cd7f06e4a6b94b160a4c554f2e @andriusch committed Sep 7, 2011
Showing with 7 additions and 5 deletions.
  1. +3 −1 lib/blueprints/extensions.rb
  2. +4 −4 spec/support/active_record/initializer.rb
View
4 lib/blueprints/extensions.rb
@@ -116,7 +116,9 @@ def blueprint_attribute(attribute, value)
if defined?(ActiveRecord)
ActiveRecord::Base.send(:include, Blueprints::Extensions::Saveable)
- class ActiveRecord::Associations::AssociationCollection
+ # AssociationCollection for ActiveRecord 3.0, Collection::Association for ActiveRecord 3.1
+ collection_class = defined?(ActiveRecord::Associations::CollectionAssociation) ? ActiveRecord::Associations::CollectionAssociation : ActiveRecord::Associations::AssociationCollection
+ collection_class.class_eval do
include Blueprints::Extensions::Blueprintable::ClassMethods
def blueprint_object(attrs)
View
8 spec/support/active_record/initializer.rb
@@ -1,3 +1,7 @@
+db_config = YAML::load(Root.join("spec/support/active_record/database.yml").read)
+ActiveRecord::Base.establish_connection(db_config)
+ActiveRecord::Base.logger = @logger
+
class Fruit < ActiveRecord::Base
belongs_to :tree
end
@@ -11,9 +15,5 @@ def fruit_after_add(_)
end
end
-db_config = YAML::load(Root.join("spec/support/active_record/database.yml").read)
-ActiveRecord::Base.establish_connection(db_config)
-ActiveRecord::Base.logger = @logger
-
@rspec1 = @version.to_s[0, 1] == '2'
@transactions = true

0 comments on commit 80e6aad

Please sign in to comment.
Something went wrong with that request. Please try again.