Ruby on Rails Wednesday, June 28, 2017


This is just a question, wanted to understand why are we checking values are present for request params over checking if key is present in request.

# File actionpack/lib/action_controller/metal/strong_parameters.rb, line 424  def require(key)    return { |k| require(k) } if key.is_a?(Array)    value = self[key]    if value.present? || value == false      value    else      raise    end  end  

so we can have params.require(:parameter).permit(:another_parameter)?


Sumit M

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment