Sha256: 90720892dc402ecdef7d27709e9f0d675f524ff4335c506aa78cb127adee6a1d
Contents?: true
Size: 621 Bytes
Versions: 6
Compression:
Stored size: 621 Bytes
Contents
module Canner module Generators class PolicyGenerator < ::Rails::Generators::NamedBase source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates')) check_class_collision suffix: "Policy" class_option :parent, type: :string, desc: "The parent class for the generated policy" def create_policy template 'policy.rb', File.join('app/policies', class_path, "#{file_name}_policy.rb") end hook_for :test_framework private def parent_class_name options.fetch("parent") do Canner::Policy end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems