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

Mitigate for people using contentful.rb to create references #105

Merged
merged 2 commits into from
Aug 17, 2016
Merged

Mitigate for people using contentful.rb to create references #105

merged 2 commits into from
Aug 17, 2016

Conversation

toadle
Copy link
Contributor

@toadle toadle commented Aug 15, 2016

Should fix contentful/contentful_model#36

I know it is a bit hacky, but the class.ancestors-thing was the only way to keep the contentful.rb-dependency out of there.

when Hash then
attr
end
if attr.is_a? Entry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be changed to attr.is_a? Entry || attr.is_a? ::Contentful::Entry, same goes for asset

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that a proper solution though, is to use the to_management_entry method in contentful_model, but this would anyway make it "easier" to work with cross-sdk content outside of rails, so I consider this approach here valid

@dlitvakb
Copy link
Contributor

Could you add specs for this use case?

@dlitvakb
Copy link
Contributor

Thanks @toadle for you help!

Cheers

@dlitvakb dlitvakb self-assigned this Aug 15, 2016
@toadle
Copy link
Contributor Author

toadle commented Aug 15, 2016

@dlitvakb Here you go. A bit hacky with the Contentful::Entry. But I think nothing else is possible, if the dependency is to be kept out.

@dlitvakb
Copy link
Contributor

Thanks @toadle!

Merging

Cheers

@dlitvakb dlitvakb merged commit c39278c into contentful:master Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating objects via Management API with many-references not working
2 participants