couchbase / couchbase-ruby-model

The Active Model implementation for Couchbase Server built on couchbase-ruby-client
61 stars 23 forks source link

encapsulation issue with Couchbase::Model ? #33

Closed infiton closed 9 years ago

infiton commented 9 years ago

when a couchbase model has a mutable attribute you cannot modify that attribute in place without changing it for all other instances of that class:

class Foo < Couchbase::Model
 attribute :foo, default: []
end

f = Foo.new
f.foo # => []
f.foo << "Hi"
f.foo #=> ["Hi"]

g = Foo.new
g.foo # => ["Hi"]
g.foo << "Bye"

f.foo # => ["Hi", "Bye"]
infiton commented 9 years ago

apologies, this is a duplicate issue: #6