Class: AbstractController::Base
- Inherits:
-
Object
- Object
- AbstractController::Base
- Defined in:
- lib/action_args/abstract_controller.rb
Class Method Summary collapse
-
.permits(*attributes) ⇒ Object
You can configure StrongParameters'
permitattributes using this DSL method.
Instance Method Summary collapse
Class Method Details
.permits(*attributes) ⇒ 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
25 26 27 28 29 30 31 |
# File 'lib/action_args/abstract_controller.rb', line 25 def self.permits(*attributes) if attributes.last.is_a?(Hash) && attributes.last. && attributes.last.has_key?(:model_name) = attributes.pop @permitting_model_name = [:model_name] end @permitted_attributes = attributes end |
Instance Method Details
#send_action(method_name, *args) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/action_args/abstract_controller.rb', line 6 def send_action(method_name, *args) return send method_name, *args unless args.empty? return send method_name, *args unless defined?(params) send_with_method_parameters_from_params method_name end |