Sha256: d39d62f6035aa1f0d0955973762e56fda52d61b5a4e7288c5812fd595db289ed

Contents?: true

Size: 1.36 KB

Versions: 12

Compression:

Stored size: 1.36 KB

Contents

class CarrierType < ApplicationRecord
  include MasterModel
  has_many :manifestations
  if ENV['ENJU_STORAGE'] == 's3'
    has_attached_file :attachment, storage: :s3,
      styles: { thumb: "16x16#" },
      s3_credentials: {
        access_key: ENV['AWS_ACCESS_KEY_ID'],
        secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
        bucket: ENV['S3_BUCKET_NAME'],
        s3_host_name: ENV['S3_HOST_NAME'],
        s3_region: ENV['S3_REGION']
      },
      s3_permissions: :private
  else
    has_attached_file :attachment,
      styles: { thumb: "16x16#" },
      path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
  end
  validates_attachment_content_type :attachment, content_type: /\Aimage\/.*\Z/

  def mods_type
    case name
    when 'volume'
      'text'
    else
      # TODO: その他のタイプ
      'software, multimedia'
    end
  end
end

# == Schema Information
#
# Table name: carrier_types
#
#  id                      :integer          not null, primary key
#  name                    :string           not null
#  display_name            :text
#  note                    :text
#  position                :integer
#  created_at              :datetime
#  updated_at              :datetime
#  attachment_file_name    :string
#  attachment_content_type :string
#  attachment_file_size    :integer
#  attachment_updated_at   :datetime
#

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
enju_biblio-0.3.18 app/models/carrier_type.rb
enju_biblio-0.3.17 app/models/carrier_type.rb
enju_biblio-0.3.16 app/models/carrier_type.rb
enju_biblio-0.3.15 app/models/carrier_type.rb
enju_biblio-0.3.14 app/models/carrier_type.rb
enju_biblio-0.3.13 app/models/carrier_type.rb
enju_biblio-0.3.12 app/models/carrier_type.rb
enju_biblio-0.3.11 app/models/carrier_type.rb
enju_biblio-0.3.10 app/models/carrier_type.rb
enju_biblio-0.3.10.rc.3 app/models/carrier_type.rb
enju_biblio-0.3.10.rc.2 app/models/carrier_type.rb
enju_biblio-0.3.10.rc.1 app/models/carrier_type.rb