Sha256: e5c8f9bb2c46de991a72c712385ba0740072e7b1c43923288d7a9ed741b36923
Contents?: true
Size: 672 Bytes
Versions: 5
Compression:
Stored size: 672 Bytes
Contents
# The content of an {Article} can contain multiple pictures. # Pictures are associated to an article through parsing the articles # content and extracting the ids of the used images. require 'carrierwave' require 'carrierwave/orm/activerecord' module Lines class Picture < Lines::ApplicationRecord # Associations belongs_to :article, touch: true, optional: true # Mount carrierwave picture uploader mount_uploader :image, PictureUploader # Callbacks before_create :default_name # Returns the default name fo a picture def default_name self.name ||= File.basename(image.filename, '.*').titleize if image end end end
Version data entries
5 entries across 5 versions & 2 rubygems