Sha256: 4b3740c1908d0c111486fdf383fbe9691e29e41c8f77970bc2909ecaba2dd796

Contents?: true

Size: 916 Bytes

Versions: 9

Compression:

Stored size: 916 Bytes

Contents

module Mack
  module Rendering
    # Used when someone calls render(:action => "index")
    class Action < Base
      
      def render
        begin
          # Try to render the action:
          return render_file(options[:action], options)
        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[:action], {:dir => MACK_PUBLIC, :ext => ".#{params(:format)}", :layout => false}.merge(options))
            # Because it's being served from public don't wrap a layout around it!
            # self.controller.instance_variable_get("@render_options").merge!({:layout => false})
            return t
          rescue Errno::ENOENT => ex
          end
          # Raise the original exception because something bad has happened!
          raise e
        end
      end
      
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mack-0.4.2.1 lib/rendering/classes/action.rb
mack-0.4.0.1 lib/rendering/classes/action.rb
mack-0.4.1 lib/rendering/classes/action.rb
mack-0.3.0 lib/rendering/classes/action.rb
mack-0.4.0 lib/rendering/classes/action.rb
mack-0.4.7 lib/rendering/classes/action.rb
mack-0.4.2 lib/rendering/classes/action.rb
mack-0.4.5 lib/rendering/classes/action.rb
mack-0.4.6 lib/rendering/classes/action.rb