On Aug 1, 2011, at 2:44 PM, Leonel *.* wrote:
> 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
>
> --
> 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
> .
>
--
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