Sha256: e7642a882649358aff226f301f2abaa64c3707a3942af95b113a9c78744c0b74

Contents?: true

Size: 694 Bytes

Versions: 27

Compression:

Stored size: 694 Bytes

Contents

module Pageflow
  module UploadedFile
    extend ActiveSupport::Concern

    included do
      attr_writer :usage_id

      belongs_to :uploader, :class_name => 'User'
      belongs_to :entry

      has_many :usages, :as => :file, :class_name => 'Pageflow::FileUsage', :dependent => :destroy
      has_many :using_revisions, :through => :usages, :source => :revision
      has_many :using_entries, :through => :using_revisions, :source => :entry
      has_many :using_accounts, :through => :using_entries, :source => :account
    end

    # this prevents shadowing of usage_id that may be provided by SELECT alias
    def usage_id
      @usage_id || read_attribute(:usage_id)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
pageflow-0.11.4 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.11.3 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.11.2 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.11.1 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.11.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.10.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.9.2 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.9.1 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.9.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.8.2 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.8.1 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.8.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.7.2 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.7.1 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.7.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.6.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.5.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.4.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.3.0 app/models/concerns/pageflow/uploaded_file.rb
pageflow-0.2.1 app/models/concerns/pageflow/uploaded_file.rb