Skip to content

Commit

Permalink
Generate UUID on create
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Apr 10, 2013
1 parent d91b209 commit cbdbc49
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class User < ActiveRecord::Base
attr_accessible :email
has_many :orders
before_validate :generate_uuid!, :on => :create

def generate_uuid!
self.uuid = SecureRandom.hex(9)
end
end

0 comments on commit cbdbc49

Please sign in to comment.