Class: PagesController

Inherits:
ApplicationController
  • Object
show all
Includes:
Iron::LocaleAware
Defined in:
lib/generators/iron/pages/templates/pages_controller.rb

Instance Method Summary collapse

Methods included from Iron::LocaleAware

#current_locale

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/generators/iron/pages/templates/pages_controller.rb', line 4

def show
  @content_type = Iron::ContentType.web_published.find_by_handle!(params[:content_type])
  @entry = Iron::SDK.send(@content_type.handle).find(params[:route])

  raise ActiveRecord::RecordNotFound unless @entry

  render "templates/#{@content_type.handle}"
rescue ActionView::MissingTemplate
  render "pages/show"
end