There is indeed a much more elegant solution. Just change your form_for
declaration and add the as
option, like this:
<%= form_for(@user, as: :user, url: user_path(@user), method: :put) do |f| %>
That way in your controller your parameters will be scoped under the user
key instead of the model's class.