photomix/app/models/secret_link_observer.rb
2012-07-27 00:26:23 +04:00

7 lines
167 B
Ruby

class SecretLinkObserver < ActiveRecord::Observer
observe :collection, :album, :photo
def before_create(record)
record.url = ::SecureRandom.hex(16)
end
end