title: What is the best way to convert all controller params from camelCase to snake_case in Rails?
body: <p>As you already know, JSON naming convention advocates the use of camelCase and the Rails advocates the use of snake_case for parameter names.</p>
  <p>What is the best way to convert all request's params to snake_case in a rails controller?</p>
  <p>From this:</p>
  <pre><code>{
    ...
    &quot;firstName&quot;: &quot;John&quot;,
    &quot;lastName&quot;: &quot;Smith&quot;,
    &quot;moreInfo&quot;:
    {
      &quot;mealType&quot;: 2,
      &quot;mealSize&quot;: 4,
      ...
    }
  }
  </code></pre>
  <p>to this:</p>
  <pre><code>{
    ...
    &quot;first_name&quot;: &quot;John&quot;,
    &quot;last_name&quot;: &quot;Smith&quot;,
    &quot;more_info&quot;:
    {
      &quot;meal_type&quot;: 2,
      &quot;meal_size&quot;: 4,
      ...
    }
  }
  </code></pre>