module Effective
  class PagesController < ApplicationController
    def show
      @pages = (Rails::VERSION::MAJOR > 3 ? Effective::Page.all : Effective::Page.scoped)
      @pages = @pages.published if params[:edit].to_s != 'true'

      @page = @pages.find(params[:id])
      raise Effective::AccessDenied unless (@page.present? && @page.roles_permit?(current_user))

      EffectivePages.authorized?(self, :show, @page)

      @page_title = @page.title

      render @page.template, :layout => @page.layout, :locals => {:page => @page}
    end
  end
end

module Effective
  class PagesController < ApplicationController
    def show
      @pages = (Rails::VERSION::MAJOR > 3 ? Effective::Page.all : Effective::Page.scoped)
      @pages = @pages.published if params[:edit].to_s != 'true'

      @page = @pages.find(params[:id])

      raise ActiveRecord::RecordNotFound unless @page.present? # Incase .find() isn't raising it
      raise Effective::AccessDenied unless @page.roles_permit?(current_user)

      EffectivePages.authorized?(self, :show, @page)

      @page_title = @page.title

      render @page.template, :layout => @page.layout, :locals => {:page => @page}
    end
  end
end

Raise the proper 404 even if find() has been overridden not to.
Raise the proper 404 even if find() has been overridden not to.
