Class: Mack::Rendering::Xml

Inherits:
Base
  • Object
show all
Defined in:
lib/rendering/classes/xml.rb

Overview

Used when someone calls render(:xml => “rss_feed”)

Instance Attribute Summary

Attributes inherited from Base

#options, #view_binder

Instance Method Summary collapse

Methods inherited from Base

#initialize, #params

Constructor Details

This class inherits a constructor from Mack::Rendering::Base

Instance Method Details

#renderObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rendering/classes/xml.rb', line 6

def render
  begin
    # Try to render the action:
    return render_file(options[:xml], options.merge(:format => :xml, :ext => ".xml.erb"))
  rescue Errno::ENOENT => e
    begin
      # If the action doesn't exist on disk, try to render it from the public directory:
      t = render_file(options[:xml], {:dir => MACK_PUBLIC, :ext => ".xml.erb", :layout => false}.merge(options.merge(:format => :xml)))
      return t
    rescue Errno::ENOENT => ex
    end
    # Raise the original exception because something bad has happened!
    raise e
  end
end