Sha256: dec4682ba3f33120309ec0ecf0bfb617d591bec8c22a71674b57df8885441b87

Contents?: true

Size: 510 Bytes

Versions: 6

Compression:

Stored size: 510 Bytes

Contents

module Comable
  class PagesController < Comable::ApplicationController
    def show
      if Rails::VERSION::MAJOR == 3
        @page = Comable::Page.find(params[:id])
      else
        @page = Comable::Page.friendly.find(params[:id])
      end
      fail ActiveRecord::RecordNotFound unless @page && (@page.published? || preview?)
    end

    private

    def preview?
      session[Comable::Page::PREVIEW_SESSION_KEY] ||= {}
      session[Comable::Page::PREVIEW_SESSION_KEY][@page.slug]
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
comable-frontend-0.7.1 app/controllers/comable/pages_controller.rb
comable-frontend-0.7.0 app/controllers/comable/pages_controller.rb
comable-frontend-0.7.0.beta2 app/controllers/comable/pages_controller.rb
comable-frontend-0.7.0.beta1 app/controllers/comable/pages_controller.rb
comable-frontend-0.6.0 app/controllers/comable/pages_controller.rb
comable_frontend-0.5.0 app/controllers/comable/pages_controller.rb