Chase Southard
unread,May 7, 2008, 5:32:39 PM5/7/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ky...@googlegroups.com
Thinking about an event registration rails app 'cause what I have now is no good... Instead of exposing /registrants/1 to the user after they fill out their information, I thought it would be better to obfuscate things a bit and give the person registering a URL they can hold on to.
Does the method below provide sufficiently randomization and robust obfuscation? Or is there something about the String.crypt() and Salt that which makes this a bad idea.
class Registrant < ActiveRecord::Base
before_save :gen_confnumber
private
def gen_confnumber
#really a string not a number. confusing.
self.confnumber = "#{self.firstname}#{self.lastname}".crypt(Time.now.strftime("%W%Y%H%M%S"))
#where %W = week of the year; %Y = year (2008); %H = hour, 24-hour clock; %M = minute; %S = second
end
end
Later,
Chase