Class: PagesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



2
3
4
# File 'app/controllers/pages_controller.rb', line 2

def show
  @page = Page.find_by_path(params[:path])
end

#view_contextObject

NOTE: This is super naughty! Rails really doesn’t want you to use content_for in controllers,

so we have to jump through this ridiculous hoop. Shouldn't do this.

see gist.github.com/hiroshi/985457 see github.com/clmntlxndr/content_for_in_controllers



11
12
13
# File 'app/controllers/pages_controller.rb', line 11

def view_context
  super.tap { |actual_view_context| actual_view_context.content_for :meta_description, @page.meta_description }
end