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-3.0.0.1 lib/ish/image_asset.rb
ish_models-0.0.33.304 lib/ish/image_asset.rb
ish_models-0.0.33.303 lib/ish/image_asset.rb
ish_models-0.0.33.302 lib/ish/image_asset.rb
ish_models-0.0.33.301 lib/ish/image_asset.rb
ish_models-0.0.33.300 lib/ish/image_asset.rb
ish_models-0.0.33.299 lib/ish/image_asset.rb
ish_models-0.0.33.298 lib/ish/image_asset.rb
ish_models-0.0.33.297 lib/ish/image_asset.rb
ish_models-0.0.33.296 lib/ish/image_asset.rb
ish_models-0.0.33.295 lib/ish/image_asset.rb
ish_models-0.0.33.294 lib/ish/image_asset.rb
ish_models-0.0.33.293 lib/ish/image_asset.rb
ish_models-0.0.33.292 lib/ish/image_asset.rb
ish_models-0.0.33.291 lib/ish/image_asset.rb
ish_models-0.0.33.287 lib/ish/image_asset.rb
ish_models-0.0.33.286 lib/ish/image_asset.rb
ish_models-0.0.33.285 lib/ish/image_asset.rb
ish_models-0.0.33.284 lib/ish/image_asset.rb
ish_models-0.0.33.283 lib/ish/image_asset.rb