Sha256: a194ab02b4c3051c2a57cd31d83db554d818afb88040937cb66d93478d684c8b

Contents?: true

Size: 982 Bytes

Versions: 5

Compression:

Stored size: 982 Bytes

Contents

class Avatar < ApplicationRecord

  belongs_to :imageable, polymorphic: true

  has_attached_file :uploaded_file,
                    :path => ":rails_root/public/avatars/:attachment/:id/:basename_:style.:extension",
                    :url => "/avatars/:attachment/:id/:basename_:style.:extension",
                    :styles => {
                        :default          => ['220x220#',  :png, :quality => 100],
                        :preview          => ['130x130#',  :png, :quality => 100],
                    },
                    :convert_options => {
                        :default          => '-set colorspace sRGB -strip',
                        :preview          => '-set colorspace sRGB -strip',
                    }

  validates_attachment :uploaded_file,
                       :presence => true,
                       :size => { :in => 0..10.megabytes },
                       :content_type => { :content_type => /^image\/(jpeg|png|gif|tiff|bmp)$/ }


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
digital_heroes_startkit-0.1.1.4 app/models/avatar.rb
digital_heroes_startkit-0.1.1.3 app/models/avatar.rb
digital_heroes_startkit-0.1.1.2 app/models/avatar.rb
digital_heroes_startkit-0.1.1.1 app/models/avatar.rb
digital_heroes_startkit-0.1.1 app/models/avatar.rb