Class: Pundit::ExpectedAttributeValues::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/pundit/expected_attribute_values/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_controller_concernObject



23
24
25
26
27
28
# File 'lib/generators/pundit/expected_attribute_values/install_generator.rb', line 23

def add_controller_concern
  inject_into_class controller_path, "ApplicationController", <<-RUBY

    include Pundit::ExpectedAttributeValues::Authorization
  RUBY
end

#add_policy_concernObject



16
17
18
19
20
21
# File 'lib/generators/pundit/expected_attribute_values/install_generator.rb', line 16

def add_policy_concern
  inject_into_class policy_path, "ApplicationPolicy", <<-RUBY

    include Pundit::ExpectedAttributeValues::Policy
  RUBY
end

#add_test_helper_snippetObject



30
31
32
# File 'lib/generators/pundit/expected_attribute_values/install_generator.rb', line 30

def add_test_helper_snippet
  template "test_helper.#{detected_test_framework}.rb", test_helper_destination
end