Added attributes= to casted model and extended doc
This commit is contained in:
parent
e48a6c8866
commit
704d0a09bd
4 changed files with 53 additions and 0 deletions
|
@ -25,5 +25,17 @@ module CouchRest
|
|||
def [] key
|
||||
super(key.to_s)
|
||||
end
|
||||
|
||||
# Sets the attributes from a hash
|
||||
def update_attributes_without_saving(hash)
|
||||
hash.each do |k, v|
|
||||
raise NoMethodError, "#{k}= method not available, use property :#{k}" unless self.respond_to?("#{k}=")
|
||||
end
|
||||
hash.each do |k, v|
|
||||
self.send("#{k}=",v)
|
||||
end
|
||||
end
|
||||
alias :attributes= :update_attributes_without_saving
|
||||
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue