Module: Cms::ContentPage::ClassMethods

Defined in:
lib/cms/content_page.rb

Instance Method Summary collapse

Instance Method Details

#template(template_name, options = {}) ⇒ Object

Specify which CMS template should be used for this controller. Works similarly to ActionController::Base#layout. Will use the named template from the appropriate directory (typically app/views/layouts/templates)

The default CMS layout will be used if no template is specified.

Examples:

template :subpage, only: [:new, :create]
template :subpage, except: [:new, :create]
template :subpage, only: [:new, :create]

Parameters:

  • template_name (Symbol)

    Name of the template with no directory prefixes or file type. (i.e. subpage, homepage)

  • options (Hash) (defaults to: {})

    (Optional)

Options Hash (options):

  • :only (Array<Symbol>)

    The actions to apply the template to.

  • :exception (Array<Symbol>)

    The actions to not apply the template to.



37
38
39
40
# File 'lib/cms/content_page.rb', line 37

def template(template_name, options={})
  self.template_name = template_name.to_s
  self.template_options = options
end