RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Easy and DRY API responses in Ruby

The gem acts_as_api provides a simple interface to determine the representation of your model data, that should be rendered in your API responses. It’s been around for some months, time to update the documentation: Gem Getting Started Page Wiki

Comments

Interesting, I like the approach. Have to think about whether I feel I prefer these declarations in model or in the views as in my gem RABL. On the fence. In some cases my APIs still seem less closely tied to the model such that I would prefer view templates but I can see other use cases where the model-centric approach makes sense. Nice gem.

Thanks for your feedback. :) I’m working on a solution to outsource the templates into modules that can be kept in /app/api_templates and then be included in a model.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in