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

Wrap jsonapi methods in a helper module to avoid polluting the controller #43

Closed
mdeutsch opened this issue Jul 25, 2017 · 4 comments
Closed

Comments

@mdeutsch
Copy link
Contributor

Rather than adding a bunch of jsonapi_* methods to the controller, add a single method that returns a helper object and define the methods in the helper. For example, jsonapi_pointers would become jsonapi.pointers.

I got this idea from the paper_trail gem: paper-trail-gem/paper_trail#719. I've done it in our Rails application to customize jsonapi-rails for our use case. If it's of interest, I can put together a PR.

@beauby
Copy link
Member

beauby commented Jul 25, 2017 via email

@beauby
Copy link
Member

beauby commented Sep 12, 2017

Hi Michael – the direction jsonapi-rails is currently taking is that of overridable hooks in the controller. I'm going to close this issue for now, but feel free to reopen it should you think of a better pattern.

@beauby beauby closed this as completed Sep 12, 2017
@mdeutsch
Copy link
Contributor Author

No worries. Sorry for dropping the ball on this -- I went out on paternity leave earlier than expected and now that I'm back I've been focused on another project.

@beauby
Copy link
Member

beauby commented Sep 12, 2017

No worries – and congratulations!

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

No branches or pull requests

2 participants