Reputation: 33
# 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
Upvotes: 3
Views: 1233
Reputation: 17631
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.
Upvotes: 2