Module: Stationed::Generators::Plugins::StrongParameters

Included in:
AppGenerator
Defined in:
lib/stationed/generators/plugins/strong_parameters.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



5
6
7
8
9
10
# File 'lib/stationed/generators/plugins/strong_parameters.rb', line 5

def self.prepended(base)
  base.class_option :strong_parameters,
    type: :boolean,
    default: true,
    desc: 'Be strict about strong parameters in development'
end

Instance Method Details

#finish_templateObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/stationed/generators/plugins/strong_parameters.rb', line 12

def finish_template
  returns uper unless options[:strong_parameters]
  environment nil, env: :development do
    <<-RUBY
# Raise an ActionController::UnpermittedParameters exception when
  # a parameter is not explcitly permitted but is passed anyway.
  config.action_controller.action_on_unpermitted_parameters = :raise
    RUBY
  end
  super
end