Sha256: a0cdea9dfb310a49936c061f624c5846a66b9b140c14e5db502552e1096767b3

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

class CarrierType < ApplicationRecord
  include MasterModel
  default_scope { order("carrier_types.position") }
  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

7 entries across 7 versions & 1 rubygems

Version Path
enju_biblio-0.3.9 app/models/carrier_type.rb
enju_biblio-0.3.8 app/models/carrier_type.rb
enju_biblio-0.3.7 app/models/carrier_type.rb
enju_biblio-0.3.6 app/models/carrier_type.rb
enju_biblio-0.3.5 app/models/carrier_type.rb
enju_biblio-0.3.4 app/models/carrier_type.rb
enju_biblio-0.3.3 app/models/carrier_type.rb