Sha256: 68ad318710510993672230e00709d05e4bca1891ad0655ad0fe90b0c11c1b571

Contents?: true

Size: 398 Bytes

Versions: 25

Compression:

Stored size: 398 Bytes

Contents

module Tenon
  class ItemAsset < ActiveRecord::Base
    # Validations
    validates_presence_of :asset
    validates_presence_of :item

    # Relationships
    belongs_to :asset
    belongs_to :item, polymorphic: true

    accepts_nested_attributes_for :asset

    after_save :reprocess_asset

    def reprocess_asset
      asset.reload.attachment.reprocess! if asset_id_changed?
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
tenon-1.0.24 app/models/tenon/item_asset.rb
tenon-1.0.23 app/models/tenon/item_asset.rb
tenon-1.0.22 app/models/tenon/item_asset.rb
tenon-1.0.21 app/models/tenon/item_asset.rb
tenon-1.0.20 app/models/tenon/item_asset.rb
tenon-1.0.19 app/models/tenon/item_asset.rb
tenon-1.0.18 app/models/tenon/item_asset.rb
tenon-1.0.17 app/models/tenon/item_asset.rb
tenon-1.0.16 app/models/tenon/item_asset.rb
tenon-1.0.15 app/models/tenon/item_asset.rb
tenon-1.0.14 app/models/tenon/item_asset.rb
tenon-1.0.13 app/models/tenon/item_asset.rb
tenon-1.0.12 app/models/tenon/item_asset.rb
tenon-1.0.11 app/models/tenon/item_asset.rb
tenon-1.0.10 app/models/tenon/item_asset.rb
tenon-1.0.9 app/models/tenon/item_asset.rb
tenon-1.0.8 app/models/tenon/item_asset.rb
tenon-1.0.7 app/models/tenon/item_asset.rb
tenon-1.0.6 app/models/tenon/item_asset.rb
tenon-1.0.5 app/models/tenon/item_asset.rb