lib/active_remote/association.rb in active_remote-1.8.1 vs lib/active_remote/association.rb in active_remote-2.0.0.rc1
- old
+ new
@@ -1,12 +1,8 @@
module ActiveRemote
module Association
- def self.included(klass)
- klass.class_eval do
- extend ::ActiveRemote::Association::ClassMethods
- end
- end
+ extend ActiveSupport::Concern
module ClassMethods
# Create a `belongs_to` association for a given remote resource.
# Specify one or more associations to define. The constantized
# class must be loaded into memory already. A method will be defined
@@ -135,11 +131,10 @@
end
private
def perform_association(associated_klass, options={})
-
define_method(associated_klass) do
klass_name = options.fetch(:class_name){ associated_klass }
klass = klass_name.to_s.classify.constantize
self.class.validate_scoped_attributes(klass, self.class, options) if options.has_key?(:scope)
@@ -152,9 +147,8 @@
end
return value
end
end
-
end
end
end