Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/restfulx.rb

Overview

Override render to add support for render :fxml

Instance Method Summary collapse

Instance Method Details

#old_renderObject



59
# File 'lib/restfulx.rb', line 59

alias_method :old_render, :render

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

so that we can have handling for :fxml option and write code like format.fxml { render :fxml => @projects }



63
64
65
66
67
68
69
70
71
# File 'lib/restfulx.rb', line 63

def render(options = nil, extra_options = {}, &block)
  if options.is_a?(Hash) && options[:fxml]
    xml = options[:fxml]
    response.content_type ||= Mime::XML
    render_for_text(xml.respond_to?(:to_fxml) ? xml.to_fxml : xml, options[:status])
  else
    old_render(options, extra_options, &block)
  end
end