Sha256: 53fee6fdfef61f38afbc597485f1fd733574d6dedc70bfc38fa7b3868bb87830
Contents?: true
Size: 473 Bytes
Versions: 152
Compression:
Stored size: 473 Bytes
Contents
require 'rails/generators' module CmAdmin module Generators class PolicyGenerator < Rails::Generators::NamedBase source_root File.expand_path('templates', __dir__) def copy_policy_files @cm_model = CmAdmin::Model.find_by({name: file_name.classify}) raise "cm_admin is not defined inside #{file_name} model" unless @cm_model.present? template "policy.rb", "app/policies/cm_admin/#{file_name}_policy.rb" end end end end
Version data entries
152 entries across 152 versions & 1 rubygems