Sha256: f5d5bb62a1ee328735ad90416c5b4073e239dd2526e9aaa7b6591180fcd86629

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 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::Configuration.public_directory, :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

1 entries across 1 versions & 1 rubygems

Version Path
mack-0.5.0 lib/rendering/classes/action.rb