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

Track changed attributes #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tim-vandecasteele
Copy link

Make it possible to use title_en_was.

This duplicates some dirty_tracking code but I didn't see another way.

@rxqd
Copy link

rxqd commented Aug 18, 2015

@tim-vandecasteele I tried your solution, but It's wrong for me.
I wrote own solution but without _was feature.
https://github.com/mli-max/globalize-accessors/commit/7fb5307e703008020b95622b262fa39e16d10af0

Your solution fails in my tests with error

Failure/Error: expect(execution_summary.changes[:title_en]).to eq [nil, "New title"]

       expected: [nil, "New title"]
            got: ["Canyoning sur le Rhône", "New title"]

It got from default title value. It's a bit unsuspected but it should be nil like in Rails way

      expect(execution_summary.changes[:title_en]).to eq nil
      execution_summary.title_en = 'New title'

      expect(execution_summary.title_en).to eq 'New title'
      expect(execution_summary.changes[:title_en]).to eq [nil, "New title"]

So, I had fr title value in title_en

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 this pull request may close these issues.

2 participants