Sha256: 55e612f19d8f5ac8221139c4aee80f8a3659130353422790a97394fcdf72fabc
Contents?: true
Size: 749 Bytes
Versions: 4
Compression:
Stored size: 749 Bytes
Contents
module Roar::Rails module ControllerAdditions extend ActiveSupport::Concern include ModelMethods module ClassMethods def responder Class.new(super).send :include, Roar::Rails::Responder end end def consume!(model) format = formats.first # FIXME: i expected request.content_mime_type to do the job. copied from responder.rb. this will return the wrong format when the controller responds to :json and :xml and the Content-type is :xml (?) extend_with_representer!(model) model.send(compute_parsing_method(format), request.body.string) # e.g. from_json("...") model end private def compute_parsing_method(format) "from_#{format}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems