Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Dirty Tracking #121

Open
roryfranklin opened this issue Oct 17, 2011 · 2 comments
Open

Disable Dirty Tracking #121

roryfranklin opened this issue Oct 17, 2011 · 2 comments

Comments

@roryfranklin
Copy link

Hi,

Is there a way to disable the dirty tracking functionality? This has been causing a lot of problems for us where documents with nested data structures aren't being saved because it doesn't think the attribute has changed, and rather than use the couchrest_attribute_will_change! method every time we need to save, we'd like to blanket turn off the functionality as we don't use it anyway.

Is that possible?

@raldred
Copy link

raldred commented Nov 2, 2011

Yeh, there's some real issues with the dirty tracking it would seem. As soon as you try to store data structures it completely falls down. Experiencing the same pain here.

@raldred
Copy link

raldred commented Nov 4, 2011

looking at the source[1] this might work

Model < CouchRest::Model::Base
    disable_dirty true
end

the comparisons in dirty are buggy, casted arrays and hashes do not correctly compare.
if you modify a deep hash/array it doesn't recognise the changes, ive been trying to figure out why.

there is a method to force couchrest into thinking a field has changed. just call it on your model instance like so...

model_instance.couchrest_attribute_will_change!('<attribute_name>')

I dont know how supported this is and may change in future versions.

[1] https://github.com/couchrest/couchrest_model/blob/master/lib/couchrest/model/dirty.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants