Registration Problem

How do i generate random number using ruby for the activation_code?
And what must be defined on the controller so that i can access the
URI using function of controller?
/activate/#{user.activation_code}"
activate is controller and suppose the activation_code is 11111

If you use authlogic, this is automatically done. In fact I strongly
recommend using authlogic for registration process.