ccocchi / rabl-rails

Rails 4.2+ templating system with JSON, XML and Plist support.
MIT License
208 stars 51 forks source link

Add custom responder #4

Closed ccocchi closed 12 years ago

ccocchi commented 12 years ago

This allow Rails to use rabl template in respond_to instead of calling to_format on the object.

For example in a PostController

def create
  @post = Post.new(params[:post])
  @post.save
  respond_with(@post)
end

create will render the responder_default_view (that can be customizable), for example show.json.rabl