Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Problem with Dirty when using dynamic properties #130

doro opened this Issue · 2 comments

3 participants


I am using couchrest model (rails project), and i want to access attributes like this:

person = Person.get(some_id)
person["name"] = "joe"

and i don't want to define "name" as a property in the Person model. the problem is that the update doesn't work (the document is not updated in couchdb), since the document is not dirty.

the reason, i think, that the document doesn't get dirty when i use the []= method is because it doesn't go via the write_attribute method that uses the Dirty mechanism, but it goes via the []= method in CouchRest::Attributes module

one solution is to do:
person.disable_dirty = true # but that seems dirty.

another solution is to do something like that:
person.send("name=", "joe")

but that's even dirtier, especially if "name" reside in a variable, it will look something like that:
person.send("#{key}=", "joe")

is there a less dirty idea/solution re this issue?


same prob for me here


first of all, you need mass_assign_any_attribute, see

class Person < CouchRest::Model::Base
  mass_assign_any_attribute true

then there is an issue with updating, see #114. there is a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.