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

Present with a class that behaves like a hash causes early rendering at best and usually hard to debug errors #1023

Closed
dblock opened this issue Jun 1, 2015 · 2 comments · Fixed by #1025

Comments

@dblock
Copy link
Member

dblock commented Jun 1, 2015

A Mongoid::Criteria, for example, responds to merge, so this was required to present it. This is because of https://github.com/intridea/grape/blob/master/lib/grape/dsl/inside_route.rb#L209, clearly we need a better solution here, maybe simple by registering representable classes?

@dblock dblock changed the title Present with a class that behaves like a hash causes early rendering Present with a class that behaves like a hash causes early rendering at best and usually hard to debug errors Jun 1, 2015
@dblock
Copy link
Member Author

dblock commented Jun 1, 2015

Maybe we can refactor this with some kind of presenter registration DSL?

@dblock
Copy link
Member Author

dblock commented Jun 1, 2015

Here're some examples of what I have on the rhs of present:

present self, with: PresenterClassThatDoesntCareWhatTheInstanceIs
present Mongoid::Document instance, with: PresenterClass
present Mongoid::Criteria instance, with: PresenterClass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant