Sha256: 03cdd0d862cbf4b930d582471ef112a6388dbd1252f2cf5edd3f168ce3e64144

Contents?: true

Size: 660 Bytes

Versions: 18

Compression:

Stored size: 660 Bytes

Contents

# This is a join table for assets and acts_as_attachable

module Effective
  class Attachment < ActiveRecord::Base
    self.table_name = EffectiveAssets.attachments_table_name.to_s

    belongs_to :asset, class_name: 'Effective::Asset'
    belongs_to :attachable, :polymorphic => true

    # structure do
    #   position        :integer
    #   box             :string, :default => 'assets'  # This is essentially a category
    # end

    default_scope -> { includes(:asset).order(:position).order(:asset_id) }

    validates :asset_id, presence: true
    validates :position, presence: true, numericality: true
    validates :box, presence: true

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
effective_assets-1.12.2 app/models/effective/attachment.rb
effective_assets-1.12.1 app/models/effective/attachment.rb
effective_assets-1.12.0 app/models/effective/attachment.rb
effective_assets-1.11.5 app/models/effective/attachment.rb
effective_assets-1.11.4 app/models/effective/attachment.rb
effective_assets-1.11.3 app/models/effective/attachment.rb
effective_assets-1.11.2 app/models/effective/attachment.rb
effective_assets-1.11.1 app/models/effective/attachment.rb
effective_assets-1.11.0 app/models/effective/attachment.rb
effective_assets-1.10.1 app/models/effective/attachment.rb
effective_assets-1.10.0 app/models/effective/attachment.rb
effective_assets-1.9.14 app/models/effective/attachment.rb
effective_assets-1.9.13 app/models/effective/attachment.rb
effective_assets-1.9.12 app/models/effective/attachment.rb
effective_assets-1.9.11 app/models/effective/attachment.rb
effective_assets-1.9.10 app/models/effective/attachment.rb
effective_assets-1.9.9 app/models/effective/attachment.rb
effective_assets-1.9.8 app/models/effective/attachment.rb