Sha256: 8f1c792107858936daf18441406a10123a71191783d5bd3e5a3efe784fe3d115
Contents?: true
Size: 626 Bytes
Versions: 30
Compression:
Stored size: 626 Bytes
Contents
class Picture < ActiveRecord::Base belongs_to :product mount_uploader :picture, PictureUploader validates_presence_of :picture before_save :update_picture_attributes %w(tiny tiny_plus small small_plus medium medium_plus large large_plus).each do |version| define_method :"#{version}_height" do picture.send(version).height end define_method :"#{version}_width" do picture.send(version).width end end private def update_picture_attributes if picture.present? self.content_type = picture.file.content_type self.file_size = picture.file.size end end end
Version data entries
30 entries across 30 versions & 1 rubygems