lib/pickle_dupe/adapter.rb in pickle-dupe-0.2.1 vs lib/pickle_dupe/adapter.rb in pickle-dupe-0.2.2
- old
+ new
@@ -18,17 +18,19 @@
def initialize(model)
# Not all dupe models has an associated model class
# so we dynamically create them here
unless @klass = (model.name.to_s.classify.constantize rescue nil)
- Object.const_set(model.name.to_s.classify, Class.new(ActiveResource::Base))
+ class_handler = Object.const_set(model.name.to_s.classify, Class.new(ActiveResource::Base))
+ class_handler.site = 'http://test.com'
+ puts "WARNING: #{model.name} model is defined dynamically because there was a dupe definition but no model was defined"
end
@name = model.name.to_s
end
def create(attrs = {})
duped_object = ::Dupe.create(@name, attrs)
- assign_missing_associations (duped_object, attrs) unless attrs.blank?
+ assign_missing_associations(duped_object, attrs) unless attrs.blank?
return duped_object
end
private
\ No newline at end of file