-
Notifications
You must be signed in to change notification settings - Fork 152
added an example spec for hash delegates and an example implemantation #85
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
added an example spec for hash delegates and an example implemantation #85
Conversation
I haven't tried it, but maybe we need a proper presenter for the Hash type in grape-entity. I mean, what's different between a real model class and a Hash anyway? |
👍 But, it will be a breaking change (regarding to the specs). Also what need's a change in my point of view is the representation of Collections. present collection_items,
with: Entities::Collection With this example every item will be wrapped in an I think the entity should have a flag or option to show that it can handle a collection Did you have a look at https://github.com/objects-on-rails/display-case? I like it's abroach to |
We can make breaking changes as long as they are meaningfully better. Personally the display-case indirection is one level too pure for me :) |
Can you please explain what you are missing? I don't want to head into the wrong direction. |
I was just commenting on display-case. That's really beyond the scope of this workitem. |
@dblock I did refactore my proposal maybe it will fit. |
I really like the implementation and I also do like |
Should |
|
PS: With a subclass you have to fix base.const_set(:Entity, Class.new(ancestor_entity_class || Grape::Entity)) unless const_defined?(:Entity) in the DSL module some how to allow Entity be a kind of |
I figured it out re: |
Ah, ok. Different timezone's have there drawback's, so I have to be fast ;) |
Hashes can now be presented Added an option to present an collection of objects with a single entity
@dblock changed & squashed |
@@ -1,6 +1,7 @@ | |||
Next | |||
==== | |||
|
|||
* [#85](https://github.com/intridea/grape-entity/pull/85): Added `present_collection` to indicate that an `Entity` presents an entire Collection. Hashes can now be passed as object to be presented. The `Hash` keys can be referenced by expose. - [@dspaeth-faber](https://github.com/dspaeth-faber). |
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.
Extra period before the -
! :)
Merged via b54bf68. Thank you. |
Specs for a hash object as delegate requested with #84