Sha256: 7937b4b7b42fff7990b2480b6aa480cdf0dc950e5e8f3635359fa8ca5c6e8ce1

Contents?: true

Size: 410 Bytes

Versions: 40

Compression:

Stored size: 410 Bytes

Contents

class Redde::Photo < ActiveRecord::Base
  mount_uploader :src, PhotoUploader
  self.table_name = 'redde_photos'

  belongs_to :imageable, polymorphic: true
  default_scope { order(:position) }
  before_save :set_token, unless: :persisted_link?

  def set_token
    self.token = SecureRandom.uuid unless token.present?
  end

  def persisted_link?
    imageable_type.present? && imageable_id.present?
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
redde-0.3.39 app/models/redde/photo.rb
redde-0.3.38 app/models/redde/photo.rb
redde-0.3.37 app/models/redde/photo.rb
redde-0.3.36 app/models/redde/photo.rb
redde-0.3.35 app/models/redde/photo.rb
redde-0.3.34 app/models/redde/photo.rb
redde-0.3.33 app/models/redde/photo.rb
redde-0.3.32 app/models/redde/photo.rb
redde-0.3.31 app/models/redde/photo.rb
redde-0.3.30 app/models/redde/photo.rb
redde-0.3.29 app/models/redde/photo.rb
redde-0.3.28 app/models/redde/photo.rb
redde-0.3.27 app/models/redde/photo.rb
redde-0.3.26 app/models/redde/photo.rb
redde-0.3.25 app/models/redde/photo.rb
redde-0.3.24 app/models/redde/photo.rb
redde-0.3.23 app/models/redde/photo.rb
redde-0.3.22 app/models/redde/photo.rb
redde-0.3.21 app/models/redde/photo.rb
redde-0.3.20 app/models/redde/photo.rb