Sha256: be04ba939adc7d568e75eca2f978e6762071ea1dd87164a64b5a9de2942a4c32
Contents?: true
Size: 646 Bytes
Versions: 22
Compression:
Stored size: 646 Bytes
Contents
module Jt class ToolboxGenerator < Rails::Generators::Base source_root File.expand_path("../templates", __FILE__) def create_initializer_file copy_file "jt-toolbox.yml", "config/jt-toolbox.yml" insert_into_file "config/routes.rb", "# https://github.com/mperham/sidekiq/wiki/Monitoring require 'sidekiq/web' class AdminConstraint def matches?(request) return false if !request.session['user_id'] user = User.find_by_id(request.session['user_id']) user && user.is_admin? end end ", before: "Rails.application.routes.draw do" route "mount Sidekiq::Web => '/sidekiq', :constraints => AdminConstraint.new" end end end
Version data entries
22 entries across 22 versions & 1 rubygems