Module: Fields::BooleanSupport

Extended by:
ActiveSupport::Concern
Included in:
ControllerSupport
Defined in:
app/controllers/concerns/fields/boolean_support.rb

Instance Method Summary collapse

Instance Method Details

#assign_boolean(strong_params, attribute) ⇒ Object



4
5
6
7
8
9
# File 'app/controllers/concerns/fields/boolean_support.rb', line 4

def assign_boolean(strong_params, attribute)
  attribute = attribute.to_s
  if strong_params.dig(attribute).present?
    strong_params[attribute] = ActiveModel::Type::Boolean.new.cast(strong_params[attribute]) || false
  end
end