Sha256: 8480a5fb602f5752eeaa3751dde32036faacf309fe24350a14eddfac40a31579

Contents?: true

Size: 586 Bytes

Versions: 5

Compression:

Stored size: 586 Bytes

Contents

module Rtml::Controller::TemplateHelpers
  def default_template_exists?
    template_exists?(default_template_name)
  end

  unless ActionController::Base.private_instance_methods.include? 'template_exists?'
    def template_exists?(template_name, fmt = response.template.template_format)
      self.view_paths.find_template(template_name, fmt)
    rescue ActionView::MissingTemplate, Errno::ENOENT
      false
    end
  end

  class << self
    def included(base)
      base.instance_eval do
        hide_action :default_template_exists?, :template_exists?
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rtml-2.0.4 lib/rtml/controller/template_helpers.rb
rtml-2.0.3 lib/rtml/controller/template_helpers.rb
rtml-2.0.2 lib/rtml/controller/template_helpers.rb
rtml-2.0.1 lib/rtml/controller/template_helpers.rb
rtml-2.0.0.alpha.1 lib/rtml/controller/template_helpers.rb