Module: ActionArgs::AbstractControllerClassMethods

Defined in:
lib/action_args/abstract_controller.rb

Instance Method Summary collapse

Instance Method Details

#permits(*attributes, model_name: nil) ⇒ Object

You can configure StrongParameters' permit attributes using this DSL method. The permit call will be invoked only against parameters having the resource model name inferred from the controller class name.

class UsersController < ApplicationController
permits :name, :age

def create(user)
  @user = User.new(user)
end
end


30
31
32
# File 'lib/action_args/abstract_controller.rb', line 30

def permits(*attributes, model_name: nil)
  @permitted_attributes, @permitting_model_name = attributes, model_name
end