Sha256: 689bf4962891a7439c764645da0e71a844141505f4cef4e6743429ee52101924

Contents?: true

Size: 1.33 KB

Versions: 119

Compression:

Stored size: 1.33 KB

Contents

# require 'aws-sdk'
require 'mongoid_paperclip'

class Ish::ImageAsset
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paperclip
  include Ish::Utils

  belongs_to :location,     class_name: 'Gameui::Map',    inverse_of: :image,       optional: true
  belongs_to :marker,       class_name: 'Gameui::Marker', inverse_of: :image,       optional: true
  belongs_to :marker_title, class_name: 'Gameui::Marker', inverse_of: :title_image, optional: true

  has_mongoid_attached_file :image,
                            :styles => {
                              :thumb  => "100x100#",
                            },
                            :storage => :s3,
                            :s3_credentials => ::S3_CREDENTIALS,
                            :path => "image_assets/:style/:id/:filename",
                            :s3_protocol => 'https',
                            :validate_media_type => false,
                            s3_region: ::S3_CREDENTIALS[:region]

  validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]

  def export_fields
    %w|
      location_id
      marker_id marker_title_id
      image_file_name image_content_type image_file_size image_updated_at image_fingerprint
    |
  end

end

Asset = Ish::ImageAsset

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
ish_models-0.0.33.221 lib/ish/image_asset.rb
ish_models-0.0.33.219 lib/ish/image_asset.rb
ish_models-0.0.33.217 lib/ish/image_asset.rb
ish_models-0.0.33.215 lib/ish/image_asset.rb
ish_models-0.0.33.214 lib/ish/image_asset.rb
ish_models-0.0.33.213 lib/ish/image_asset.rb
ish_models-0.0.33.212 lib/ish/image_asset.rb
ish_models-0.0.33.211 lib/ish/image_asset.rb
ish_models-0.0.33.210 lib/ish/image_asset.rb
ish_models-0.0.33.209 lib/ish/image_asset.rb
ish_models-0.0.33.208 lib/ish/image_asset.rb
ish_models-0.0.33.207 lib/ish/image_asset.rb
ish_models-0.0.33.206 lib/ish/image_asset.rb
ish_models-0.0.33.205 lib/ish/image_asset.rb
ish_models-0.0.33.204 lib/ish/image_asset.rb
ish_models-0.0.33.203 lib/ish/image_asset.rb
ish_models-0.0.33.202 lib/ish/image_asset.rb
ish_models-0.0.33.201 lib/ish/image_asset.rb
ish_models-0.0.33.200 lib/ish/image_asset.rb
ish_models-0.0.33.199 lib/ish/image_asset.rb