Query controller using two resources

I have an activation link. I want the user to click on the link, kinda
like this...

domain.com/users/45/activate/1jf872

The number after "users" would be the user id, and the string after
"activate" would be the activation code. In the link above it would be
user id 45 and activation code 1jf872.

I have no problem sending the email. My problem is getting the route
(the url) recognized.

I have this in routes...

I'm trying to get a url like

/users/45/invitation/ej3j3j (for invitation form, where you enter the
password)

and another
/users/45/activate (for submitting the form)

You could use /users/45/invitation?activation=ej3j3j
or something similar.

Colin

routes.rb

I have an activation link. I want the user to click on the link, kinda
like this...

domain.com/users/45/activate/1jf872

The number after "users" would be the user id, and the string after
"activate" would be the activation code. In the link above it would be
user id 45 and activation code 1jf872.

I have no problem sending the email. My problem is getting the route
(the url) recognized.

I have this in routes...
----------------------------------
resources :users do
member do
   get :activate
end
end

try get ':activate/:activation_code'

----------------------------------
users_controller.rb
----------------------------------
def activate
@user = User.find(params[:id])
end
-----------------------------------

Along those same lines, try User.find_by_id_and_activation_code(params)

Which finds the user. But how can I make the query to find by both the
user id and the activation code?

like select users where users.id = 45 and activation_code = 1jf872

Walter

Walter Davis wrote in post #1014258:

try get ':activate/:activation_code'

Along those same lines, try User.find_by_id_and_activation_code(params)

Thanks, but I tried it and I get this error when trying to start the
server...

Exiting
/var/lib/gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/routing/mapper.rb:171:in
`default_controller_and_action': missing :action (ArgumentError)
  from
/var/lib/gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/routing/mapper.rb:72:in
`normalize_options!'

Walter Davis wrote in post #1014258:

try get ':activate/:activation_code'

Along those same lines, try User.find_by_id_and_activation_code(params)

Thanks, but I tried it and I get this error when trying to start the
server...

Exiting
/var/lib/gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/routing/mapper.rb:171:in
`default_controller_and_action': missing :action (ArgumentError)
from
/var/lib/gems/1.8/gems/actionpack-3.0.9/lib/action_dispatch/routing/mapper.rb:72:in
`normalize_options!'

Try 'activate/:activation_code' instead -- There wouldn't be any map Have a read through the routing guide, too, I may have something wrong. Try using a match statement rather than get directly. I'm not sure if this syntax is supported by get.

Walter