app/models/redde/photo.rb in redde-0.4.1 vs app/models/redde/photo.rb in redde-0.4.2

- old
+ new

@@ -1,13 +1,13 @@ class Redde::Photo < ActiveRecord::Base mount_uploader :src, PhotoUploader self.table_name = 'redde_photos' - if Rails.version.split('.').join.to_i > 510 - belongs_to :imageable, polymorphic: true, optional: true - else - belongs_to :imageable, polymorphic: true - end + opts = { polymorphic: true } + opts.merge!(optional: true) if Rails.version.split('.').join.to_i > 510 + + belongs_to :imageable, opts + default_scope { order(:position) } before_save :set_token, unless: :persisted_link? def set_token self.token = SecureRandom.uuid unless token.present?