# routes.rb
resource: :users, only: :create, path_names: { create: 'register' }
Following the routing guide at guides.rubyonrails.org, this line is expected to replace /users with /users/register, but the path_names argument seems to have no effect whatsoever. What am I doing wrong?
EDIT: Interesting that it only applies to new and edit. In any case, this is the work around I used
resource :users, only: :nothing do
post "register", to: :create
end
Done this way to make it slightly easier to enable more actions for users in the future
From rails guide:
The :path_names option lets you override the automatically-generated "new" and "edit" segments in paths
It seems that you can't rename the create action.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With