I cannot even write more than a helo world in ruby, but - if you want
to trust someone that claims to be incompentent right away:
Looking at app/models/user.rb I conclude
def activated?
# the existence of an activation code means they have not activated yet
activation_code.nil?
end
-> Activation is checked by looking if there is an activation code
# Activates the user in the database.
def activate
@activated = true
self.attributes = {:activated_at => Time.now.utc, :activation_code => nil}
save(false)
end
-> Activation just means deleting the activation code and setting a
timestamp. The latter is probably not important?
def make_activation_code
self.activation_code = Digest::SHA1.hexdigest(
Time.now.to_s.split(//).sort_by {rand}.join )
end
-> This sets an activation code (and therefor the user is _not_
activated after that, see above).
If this blows up your system I'm not to blame, but I'd just try to
comment this single line in make_activation_code. I suspect that this
leads to users being created without an activation code, which again
should treat them as activated by default.
Note: This doesn't handle sending mails (I can try to look for that,
if you want). I'm only concerned with "auto-activation" for now.
Regards,
Ben
On Thu, Jan 28, 2010 at 9:33 AM, Marius Mårnes Mathiesen
<[email protected]> wrote:
> On Thu, Jan 28, 2010 at 9:27 AM, Grokix <[email protected]> wrote:
>>
>> Unfortunately, I'm not a Ruby hacker ;).
>>
>> Now, I do this:
>>
>> $ env RAILS_ENV=production ruby script/console
>> > user = User.find_by_login "username"
>> > user.activate
>> > user.save
>
>
> I'd say that more or less makes you a Ruby hacker :-)
> - Marius
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
>
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]