-
Notifications
You must be signed in to change notification settings - Fork 64
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
Unify Locale Handling #78
Conversation
34c170a
to
5abb41f
Compare
expect(cat.fields[:name][:'en-US']).to eq "Nyan Cat" | ||
expect(cat.fields[:name][:'es']).to eq "Gato Nyan" | ||
expect(cat.fields('en-US')[:name]).to eq "Nyan Cat" | ||
expect(cat.fields('es')[:name]).to eq "Gato Nyan" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure why we are reversing the order of parameters here? It'll be a breaking change.
In any case, the locale parameter should be a symbol, otherwise it'll be inconsistent with field_with_locales
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually the expected behavior of fields
, I was omitting that behavior in order to be able to serialize correctly in contentful_middleman
.
This, though breaking is undocumented anywhere else than this test, and is fixing the dispaired behavior.
fields_with_locales
is the in place replacement for this functionality, and it is documented properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, this is actually the documented way, at least for sync
: https://github.com/contentful/contentful.rb/blame/master/README.md#L327
I still think we should make both methods consistent in their use of symbols vs. strings for the locales, otherwise it'll be confusing.
5abb41f
to
df258b3
Compare
Fixes #73