I made a gem that (hopefully) provides a simple way to reduce bloat in controllers.

14 views
Skip to first unread message

Preston Sego

unread,
Nov 25, 2015, 12:54:03 PM11/25/15
to rubyonra...@googlegroups.com
...while making testing easier.

The gem is 'skinny_controllers'

https://github.com/NullVoxPopuli/skinny_controllers

It's inspired by trailblazer, but sticks more to how rails is laid out.

To use the default functionality, for each of your actions, you can just
do:

render json: model

or however you want to render the response. model is a memoized method
that looks up an operation and policy and applies whatever custom logic
you want to implement.

Checkout the readme for details.


I'm using this gem in a production sass project with Ember as my
frontend and ActiveModelSerializers for helping structure JSON, so
support for skinny_controllers isn't going away ever.


Hope you like it :-)

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages