Sha256: de9a8e15d5d0dc1bb3e17a73cc8b54d099e95c070731e7c2084bf9d4d2ef8b6a
Contents?: true
Size: 557 Bytes
Versions: 21
Compression:
Stored size: 557 Bytes
Contents
module Spina class Attachment < ApplicationRecord has_one_attached :file attr_accessor :_destroy scope :sorted, -> { order('created_at DESC') } def name file.filename.to_s end def content file if file.attached? end def present? signed_blob_id.present? end alias_method :old_update, :update def update(attributes) if attributes["_destroy"] == "1" && attributes["file"].blank? self.page_part.destroy else old_update(attributes) end end end end
Version data entries
21 entries across 21 versions & 1 rubygems