Sha256: b1911ce2d055981dd69659e8e2d07a5581b3cd6faea8c30502bc2ed93d0f7fb7

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

class CarrierType < ApplicationRecord
  include MasterModel
  default_scope { order("carrier_types.position") }
  translates :display_name
  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      :bigint
#  attachment_updated_at     :datetime
#  display_name_translations :jsonb            not null
#

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enju_biblio-0.4.0.rc.1 app/models/carrier_type.rb
enju_biblio-0.4.0.beta.2 app/models/carrier_type.rb
enju_biblio-0.4.0.beta.1 app/models/carrier_type.rb