spec/support/app/models/sample.rb in hydra-batch-edit-0.0.5 vs spec/support/app/models/sample.rb in hydra-batch-edit-0.0.6
- old
+ new
@@ -14,14 +14,13 @@
@pid ||= "sample:#{(rand * 1000).to_i}"
self.class.objects[@pid] = self
end
def update_attributes(attributes)
- metaclass = class << self; self; end
attributes.each do |k, v|
- metaclass.send(:define_method, k) do
- v
- end
+ instance_variable_set "@#{k.to_s}".to_sym, v
+
+ self.class.send :attr_accessor, k
end
end
def self.find(pid)
objects[pid]