def set_page
      title = params[:id] || params[:page_id] || params[:path]
      raise ActiveRecord::RecordNotFound, "Unknown page request" unless title

      @page = select_page(title)

      unless @page
        if user_can?(:create_page)
          return redirect_to new_page_path(title: title)
        else
          if title == "Home"
            @page = special_page("Welcome")
          else
            raise ActiveRecord::RecordNotFound, "Could not find page '#{title}'"
          end
        end
      end
    end
def set_page
      title = params[:id] || params[:page_id] || params[:path]
      raise ActiveRecord::RecordNotFound, "Unknown page request" unless title

      @page = select_page(title)

      unless @page
        if user_can?(:create_page)
          return redirect_to new_page_path(title: title)
        else
          if title == "Home"
            @page = special_page("Welcome")
          else
            raise ActiveRecord::RecordNotFound, "Could not find page '#{title}'"
          end
        end
      end
    end
Use callbacks to share common setup or constraints between actions.