Sha256: 4847ad1dacec760121a84b2561f5a4b5e52f90cefb55f22d1df3c505abcd5409

Contents?: true

Size: 445 Bytes

Versions: 8

Compression:

Stored size: 445 Bytes

Contents

require 'mongoid'

module SimpleFormAttachments
  module Attachment
    extend ActiveSupport::Concern

    included do
      include Mongoid::Document

      field :temporary, type: Boolean, default: true

      scope :temporary, -> { where(temporary: true) }
      scope :permanent, -> { where(temporary: false) }

      def to_simple_form_partial_path
        ['simple_form_attachments', to_partial_path].join('/')
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
simple_form_attachments-0.1.5 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.1.4 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.1.3 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.1.2 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.1.1 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.1.0 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.0.9 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.0.8 app/models/concerns/simple_form_attachments/attachment.rb