Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

Field rendering by passing raw data, not relying on object lookup #36

Open
soundofjw opened this issue Oct 21, 2015 · 1 comment
Open

Comments

@soundofjw
Copy link

Currently, field rendering requires obj and field.

It may be necessary to pass a raw value to render for a field from _render_serializable for a resource, for cases when data comes in that is not specifically on an underlying model.

@rknLA
Copy link
Contributor

rknLA commented Nov 3, 2015

Philosophically, I'm not a fan of this. It seems to encourage messiness. If the data is worth putting into the response, then it's worth modeling in a proper view model. Maybe it doesn't make sense to put the data into the db model layer, but I think it's better to put that kind of logic into a model/controller/whatever you want to call it, rather than directly in the view itself..

I also can't think of any use cases where this would actually be preferable to encapsulating the logic that generates the "raw value" into an object, so if you could provide an example, I'd appreciate it.

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

No branches or pull requests

2 participants