Class: ActionPolicy::Generators::PolicyGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/action_policy/policy/policy_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_policyObject



20
21
22
# File 'lib/generators/action_policy/policy/policy_generator.rb', line 20

def create_policy
  template "policy.rb", File.join("app/policies", class_path, "#{file_name}_policy.rb")
end

#run_install_if_neededObject



12
13
14
15
16
17
18
# File 'lib/generators/action_policy/policy/policy_generator.rb', line 12

def run_install_if_needed
  in_root do
    return if File.exist?("app/policies/application_policy.rb")
  end

  generate "action_policy:install"
end