Module: Rtml::Controller::TemplateHelpers

Defined in:
lib/rtml/controller/template_helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



15
16
17
18
19
# File 'lib/rtml/controller/template_helpers.rb', line 15

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

Instance Method Details

#default_template_exists?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/rtml/controller/template_helpers.rb', line 2

def default_template_exists?
  template_exists?(default_template_name)
end

#template_exists?(template_name, fmt = response.template.template_format) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/rtml/controller/template_helpers.rb', line 7

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