Sha256: 125e4344b7a1dff261d3b44e75bb42f28cd971719f748e9d4e066d9330b0f2f2

Contents?: true

Size: 599 Bytes

Versions: 1

Compression:

Stored size: 599 Bytes

Contents

module Cas
  class Sections::ApplicationController < ApplicationController
    before_action :load_section

    private

    def load_section
      @section ||= ::Cas::Section.friendly.find(params[:section_id])
    end

    def scope_content_by_role(model_relation = ::Cas::Content)
      # Only admins and editors can see other people's content
      if !current_user.admin? && !current_user.editor?
        model_relation = model_relation.where(author_id: current_user.id)
      end
      model_relation
    end

    def load_categories
      @categories ||= @section.categories
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cas-cms-0.1.0 app/controllers/cas/sections/application_controller.rb