Sha256: d3198749511c50df3201bb05ec88e17eff73b7e31661fb658bd244bbaa791362

Contents?: true

Size: 1.41 KB

Versions: 11

Compression:

Stored size: 1.41 KB

Contents

class CarrierType < ActiveRecord::Base
  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

11 entries across 11 versions & 2 rubygems

Version Path
enju_biblio-0.3.2 app/models/carrier_type.rb
enju_biblio-0.3.1 app/models/carrier_type.rb
enju_biblio-0.3.0 app/models/carrier_type.rb
enju_biblio-0.3.0.rc.1 app/models/carrier_type.rb
enju_biblio-0.3.0.beta.2 app/models/carrier_type.rb
enju_biblio-0.2.5 app/models/carrier_type.rb
enju_biblio-0.2.4 app/models/carrier_type.rb
enju_biblio-0.2.3 app/models/carrier_type.rb
enju_biblio-0.2.2 app/models/carrier_type.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/enju_biblio-0.2.1/app/models/carrier_type.rb
enju_biblio-0.2.1 app/models/carrier_type.rb