Sha256: 8d324c9abab37756a672c5d7867f6d35655d336aa5a2ec036ed5ba90e18972bf

Contents?: true

Size: 986 Bytes

Versions: 3

Compression:

Stored size: 986 Bytes

Contents

module Restfulie
  module Server
    module ActionController

      module Base

        def self.included(base)
          # Sets a default responder for this controller. 
          # Needs to require responder_legacy.rb
          base.responder = Restfulie::Server::ActionController::RestfulResponder
          # Atom representation is added by default
          ParamsParser.register('application/atom+xml', Restfulie::Common::Representation::Atom)
        end

      protected
      
        # If your controller inherits from Restfulie::Server::Controller::Base,
        # it will have an :atom option, very similar to render :xml
        def render(options = {}, extra_options = {}, &block)
          if atom = options[:atom]
            response.content_type ||= Mime::ATOM
            render_for_text(atom.respond_to?(:to_atom) ? atom.to_atom.to_xml : atom.to_xml, options[:status])
          else
            super
          end
        end
        
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
restfulie-0.7.2 lib/restfulie/server/action_controller/base.rb
restfulie-0.7.1 lib/restfulie/server/action_controller/base.rb
restfulie-0.7.0 lib/restfulie/server/action_controller/base.rb