Module: Restfulie::Server::ActionController::Base

Defined in:
lib/restfulie/server/action_controller/base.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
# File 'lib/restfulie/server/action_controller/base.rb', line 5

def self.included(base)
  # Sets a default responder for this controller. 
  # Needs to require responder_legacy.rb
  base.responder = Restfulie::Server::ActionController::RestfulResponder
  base.extend(Restfulie::Server::ActionController::Base::ClassMethods)
end

Instance Method Details

#render(options = nil, extra_options = {}, &block) ⇒ Object

If your controller inherits from Restfulie::Server::Controller::Base, it will have an :atom option, very similar to render :xml



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/restfulie/server/action_controller/base.rb', line 32

def render(options = nil, extra_options = {}, &block)
  if options && atom = options[:atom]
    response.content_type ||= Mime::ATOM
    representation = atom.respond_to?(:to_atom) ? atom.to_atom.to_xml : atom.to_xml
    options[:text] = representation
    options[:atom] = nil
    super options
  else
    super
  end
end