lib/machinist/mongo_mapper.rb in machinist_mongo-1.0.2 vs lib/machinist/mongo_mapper.rb in machinist_mongo-1.1.0
- old
+ new
@@ -7,10 +7,21 @@
puts "MongoMapper is not installed (gem install mongo_mapper)"
exit
end
module Machinist
+
+ class Lathe
+ def assign_attribute(key, value)
+ assigned_attributes[key.to_sym] = value
+ if @object.respond_to? "#{key}="
+ @object.send("#{key}=", value)
+ else
+ @object[key] = value
+ end
+ end
+ end
class MongoMapperAdapter
def self.has_association?(object, attribute)
object.class.associations[attribute]
end
@@ -67,6 +78,6 @@
end
MongoMapper::Document.append_extensions(Machinist::Blueprints::ClassMethods)
MongoMapper::Document.append_extensions(Machinist::MongoMapperExtensions::Document)
MongoMapper::EmbeddedDocument::ClassMethods.send(:include, Machinist::Blueprints::ClassMethods)
-MongoMapper::EmbeddedDocument::ClassMethods.send(:include, Machinist::MongoMapperExtensions::EmbeddedDocument)
\ No newline at end of file
+MongoMapper::EmbeddedDocument::ClassMethods.send(:include, Machinist::MongoMapperExtensions::EmbeddedDocument)