Sha256: d0d22b767a46ea195bc0efadb2e0a70d86a8fa5ac162addc8eba0d916d27c0cf

Contents?: true

Size: 989 Bytes

Versions: 23

Compression:

Stored size: 989 Bytes

Contents

module Naf
  class JanitorialCreateAssignment < JanitorialAssignment
    # Protect from mass-assignment issue
    attr_accessible :model_name,
                    :assignment_order,
                    :enabled,
                    :deleted

    #--------------------
    # *** Validations ***
    #++++++++++++++++++++

    validate :deleted_enabled_check
    validates :assignment_order, numericality: {
                                   only_integer: true,
                                   greater_than_or_equal_to: 0,
                                   less_than: 2147483647
                                 }
    validates :model_name, presence: true

    #-------------------------
    # *** Instance Methods ***
    #+++++++++++++++++++++++++

    def do_janitorial_work(target_model)
      target_model.create_new_partitions
    end

    def deleted_enabled_check
      if deleted && enabled
        errors.add(:deleted, "or Enabled must be false")
      end
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
naf-2.1.13 app/models/naf/janitorial_create_assignment.rb
naf-2.1.12 app/models/naf/janitorial_create_assignment.rb
naf-2.1.11 app/models/naf/janitorial_create_assignment.rb
naf-2.1.10 app/models/naf/janitorial_create_assignment.rb
naf-2.1.9 app/models/naf/janitorial_create_assignment.rb
naf-2.1.8 app/models/naf/janitorial_create_assignment.rb
naf-2.1.6 app/models/naf/janitorial_create_assignment.rb
naf-2.1.5 app/models/naf/janitorial_create_assignment.rb
naf-2.1.4 app/models/naf/janitorial_create_assignment.rb
naf-2.1.3 app/models/naf/janitorial_create_assignment.rb
naf-2.1.2 app/models/naf/janitorial_create_assignment.rb
naf-2.1.1 app/models/naf/janitorial_create_assignment.rb
naf-2.1.0 app/models/naf/janitorial_create_assignment.rb
naf-2.0.4 app/models/naf/janitorial_create_assignment.rb
naf-2.0.3 app/models/naf/janitorial_create_assignment.rb
naf-2.0.2 app/models/naf/janitorial_create_assignment.rb
naf-2.0.1 app/models/naf/janitorial_create_assignment.rb
naf-2.0.0 app/models/naf/janitorial_create_assignment.rb
naf-1.1.4 app/models/naf/janitorial_create_assignment.rb
naf-1.1.3 app/models/naf/janitorial_create_assignment.rb