photomix/app/models/secret_link_observer.rb

8 lines
167 B
Ruby
Raw Normal View History

2012-07-26 22:26:23 +02:00
class SecretLinkObserver < ActiveRecord::Observer
observe :collection, :album, :photo
def before_create(record)
record.url = ::SecureRandom.hex(16)
end
end