Using |attribute_name, attribute_value| instead of |k,v|.
This commit is contained in:
parent
0ed7413703
commit
1315d65681
|
@ -277,16 +277,16 @@ module CouchRest
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_properties_exist(attrs)
|
def check_properties_exist(attrs)
|
||||||
attrs.each do |k, v|
|
attrs.each do |attribute_name, attribute_value|
|
||||||
raise NoMethodError, "#{k}= method not available, use property :#{k}" unless self.respond_to?("#{k}=")
|
raise NoMethodError, "#{attribute_name}= method not available, use property :#{attribute_name}" unless self.respond_to?("#{attribute_name}=")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_attributes(hash)
|
def set_attributes(hash)
|
||||||
attrs = remove_protected_attributes(hash)
|
attrs = remove_protected_attributes(hash)
|
||||||
attrs.each do |k,v|
|
attrs.each do |attribute_name, attribute_value|
|
||||||
if self.respond_to?("#{k}=")
|
if self.respond_to?("#{attribute_name}=")
|
||||||
self.send("#{k}=", attrs.delete(k))
|
self.send("#{attribute_name}=", attrs.delete(attribute_name))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue