Sha256: 80a43c1993af13fdcb17676b5d70eb36ec93c1bf69de19da69c16a819e681fe2

Contents?: true

Size: 498 Bytes

Versions: 19

Compression:

Stored size: 498 Bytes

Contents

class Connection
	include Mongoid::Document
  embedded_in :base

	field :order_id,  type: Integer, default: 0
	field	:parent_id, type: BSON::ObjectId
  field :file,      type: String
  field :section,   type: String

  #validations
	validates_numericality_of :order_id, greater_than_or_equal_to: 0
  validate :parent_id_should_exist

	def parent_id_should_exist
    if parent_id != nil and !Base.exists?(conditions: {id: parent_id})
      errors.add :parent_id, "id doesn't exist"
    end
	end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
classiccms-0.5.6 lib/classiccms/models/connection.rb
classiccms-0.5.5 lib/classiccms/models/connection.rb
classiccms-0.5.2 lib/classiccms/models/connection.rb
classiccms-0.5.1 lib/classiccms/models/connection.rb
classiccms-0.5.0 lib/classiccms/models/connection.rb
classiccms-0.4.2 lib/classiccms/models/connection.rb
classiccms-0.4.1 lib/classiccms/models/connection.rb
classiccms-0.4.0 lib/classiccms/models/connection.rb
classiccms-0.3.9 lib/classiccms/models/connection.rb
classiccms-0.3.8 lib/classiccms/models/connection.rb
classiccms-0.3.7 lib/classiccms/models/connection.rb
classiccms-0.3.6 lib/classiccms/models/connection.rb
classiccms-0.3.5 lib/classiccms/models/connection.rb
classiccms-0.3.4 lib/classiccms/models/connection.rb
classiccms-0.3.3 lib/classiccms/models/connection.rb
classiccms-0.3.2 lib/classiccms/models/connection.rb
classiccms-0.3.1 lib/classiccms/models/connection.rb
classiccms-0.3.0 lib/classiccms/models/connection.rb
classiccms-0.2.4.pre lib/classiccms/models/connection.rb