lib/pickle/adapter.rb in pickle-0.2.9 vs lib/pickle/adapter.rb in pickle-0.2.10
- old
+ new
@@ -1,5 +1,7 @@
+require 'active_support/core_ext'
+
module Pickle
# Abstract Factory adapter class, if you have a factory type setup, you
# can easily create an adaptor to make it work with Pickle.
#
# The factory adaptor must have a #factories class method that returns
@@ -13,10 +15,15 @@
def create(attrs = {})
raise NotImplementedError, "create and return an object with the given attributes"
end
- cattr_writer :model_classes
+ if respond_to?(:class_attribute)
+ class_attribute :model_classes
+ else
+ cattr_writer :model_classes
+ end
+
self.model_classes = nil
class << self
def factories
raise NotImplementedError, "return an array of factory adapter objects"
\ No newline at end of file