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.242 lib/ish/image_asset.rb
ish_models-0.0.33.241 lib/ish/image_asset.rb
ish_models-0.0.33.240 lib/ish/image_asset.rb
ish_models-0.0.33.239 lib/ish/image_asset.rb
ish_models-0.0.33.238 lib/ish/image_asset.rb
ish_models-0.0.33.237 lib/ish/image_asset.rb
ish_models-0.0.33.236 lib/ish/image_asset.rb
ish_models-0.0.33.235 lib/ish/image_asset.rb
ish_models-0.0.33.234 lib/ish/image_asset.rb
ish_models-0.0.33.233 lib/ish/image_asset.rb
ish_models-0.0.33.232 lib/ish/image_asset.rb
ish_models-0.0.33.231 lib/ish/image_asset.rb
ish_models-0.0.33.230 lib/ish/image_asset.rb
ish_models-0.0.33.229 lib/ish/image_asset.rb
ish_models-0.0.33.228 lib/ish/image_asset.rb
ish_models-0.0.33.227 lib/ish/image_asset.rb
ish_models-0.0.33.226 lib/ish/image_asset.rb
ish_models-0.0.33.225 lib/ish/image_asset.rb
ish_models-0.0.33.224 lib/ish/image_asset.rb
ish_models-0.0.33.222 lib/ish/image_asset.rb