Possible Duplicate:
Ruby on Rails Callback, what is difference between :before_save and :before_create?
I'm looking to replace Ruby on Rails current id from /1, /2, /3, etc to a randomly generated URL, for example /csd8dsv68dvs.
After looking into creating it, I found this in the post model
before_create { self.code = SecureRandom.hex(5) }
What does the before_create do and how can I implement the random id?
Update
It seems I got one part wrong. I'm not looking to change the ID, I just want to change the URL to a random string that a user won't be able to guess.