Syntax you are using is for adding prefix to the default URL generated by Rails. It looks like that is not what you want.
When you expose a controller as a resource, following actions are automatically added:
show
index
new
create
edit
update
destroy
These actions can be categorized in to two groups:
The URL for the member action has the id of the target resource. E.g:
users/1/edit
users/1
You can think of :member
action as an instance method on a class. It always applies on an existing resource.
Default member actions: show
, edit
, update
, destroy
The URL for the :collection
action does not contain the id of the target resource. E.g:
users/login
users/register
You can think of :collection
action as a static method on a class.
Default collection actions: index
, new
, create
In your case you need two new actions for registration. These actions belong to :collection type( as you do not have the id of the user while submitting these actions). Your route can be as follows:
map.resources :users, :collection => { :signup => :get, :register => :post }
The URL for the actions are as follows:
users/signup
users/register
If you want to remove a standard action generated by Rails use :except/:only options:
map.resources :foo, :only => :show
map.resources :foo, :except => [:destroy, :show]
Edit 1
I usually treat the confirmation
action as a :member
action. In this case params[id]
will contain the confirmation code.
Route configuration:
map.resources :users, :member => { :confirm => :get}
URL
/users/xab3454a/confirm
confirm_user_path(:id => @user.confirmation_code) # returns the URL above
Controller
class UsersController < ApplicationController
def confirm
# assuming you have an attribute in `users` table called `confirmation_code`
if User.find_by_confirmation_code(params[id])
# success
else
# error
end
end
end