Created
January 13, 2016 00:25
-
-
Save jcohenho/9ca3c55207e05e535ffc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Product | |
### attributes: product_name, uid | |
validates_uniqueness_of :uid | |
before_save :set_uid | |
private | |
def set_uid | |
self.uid = product_name + SecureRandom.hex | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment