Ruby on Rails Monday, August 1, 2011

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
----------------------------------
users_controller.rb
----------------------------------
def activate
@user = User.find(params[:id])
end
-----------------------------------

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

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment