Sha256: d55682cec9ffd845978e0b67c5dbb5fa3c4bca94d62a4a774a5374b71f46a9fd

Contents?: true

Size: 440 Bytes

Versions: 4

Compression:

Stored size: 440 Bytes

Contents

require 'mongoid'

module SimpleFormAttachments
  module Attachment
    extend ActiveSupport::Concern

    included do
      include Mongoid::Document

      field :temporary, type: Boolean, default: false

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_form_attachments-0.2.3 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.2.2 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.2.1 app/models/concerns/simple_form_attachments/attachment.rb
simple_form_attachments-0.2.0 app/models/concerns/simple_form_attachments/attachment.rb