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

Dirty tracking on Rails 4.2 with remote_foo_url considers upload field changed even when unchanged, messing with PaperTrail #2409

Closed
henrik opened this issue Aug 16, 2019 · 2 comments · Fixed by #2658

Comments

@henrik
Copy link

henrik commented Aug 16, 2019

I've got a Company with a mounted logo.

Changing just the company name is dirty-tracked as expected:

c.name = "Bar"
c.changed_attributes
# => {"name"=>"Foo"}

But I've got a form with direct-to-S3-uploads that will then post a hidden-field remote_logo_url when submitted. If I just edit the name via the form and leave the remote_logo_url hidden-field empty, this happens:

c.name = "Bar"
c.remote_logo_url = ""
c.changed_attributes
# => {"name"=>"Foo", "logo"=> #<CompanyLogoUploader:0x00005604560dbac8 …

This in turn means that PaperTrail will track the logo as changed every time the form is used, even if the logo is left unchanged.

I have not checked if this is also the case on later versions of Rails, or if you're not using the remote_foo_url functionality.

@henrik
Copy link
Author

henrik commented Aug 20, 2020

After upgrading to Rails 5.1 it seems this issue went away.

EDIT: Spoke too soon. It did not.

@henrik
Copy link
Author

henrik commented Mar 13, 2023

@mshibuya Oh, did not expect this to suddenly get adressed. Thanks for that :)

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

Successfully merging a pull request may close this issue.

2 participants