Sha256: f7ad965586fa6b536b61e4f5b4491b345bcf4c5fba57f688dea4a9f5a82571f2

Contents?: true

Size: 702 Bytes

Versions: 4

Compression:

Stored size: 702 Bytes

Contents

require_dependency "admin/articles_controller"

module Admin
  class AuthorizedArticlesController < ArticlesController
    include Godmin::Authorization

    def admin_user
      "admin"
    end

    def new
      # The following calls to #policy are to check that the Authorization
      # module can handle various different scenarios:
      policy(Magazine).index?
      policy(::Magazine).index?
      policy(Magazine.new).index?
      policy(Magazine.all).index?
      policy(Admin::Magazine).index?
      policy(Admin::Magazine.new).index?
      policy(Admin::Magazine.where(name: "name")).index?

      super
    end

    def resource_service_class
      Admin::ArticleService
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
godmin-2.3.0 test/dummy/admin/app/controllers/admin/authorized_articles_controller.rb
godmin-2.2.2 test/dummy/admin/app/controllers/admin/authorized_articles_controller.rb
godmin-2.2.1 test/dummy/admin/app/controllers/admin/authorized_articles_controller.rb
godmin-2.2.0 test/dummy/admin/app/controllers/admin/authorized_articles_controller.rb