Sha256: ff7cf4b7dade05a06b827024f81a96fb212800268a292200f68f0446b4b5328f

Contents?: true

Size: 498 Bytes

Versions: 27

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: Moped::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.where(_id: parent_id).exists?
      errors.add :parent_id, "id doesn't exist"
    end
	end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
classiccms-0.5.13 lib/classiccms/models/connection.rb
classiccms-0.5.12 lib/classiccms/models/connection.rb
classiccms-0.5.11 lib/classiccms/models/connection.rb
classiccms-0.5.10 lib/classiccms/models/connection.rb
classiccms-0.5.9 lib/classiccms/models/connection.rb
classiccms-0.5.8 lib/classiccms/models/connection.rb
classiccms-0.5.7 lib/classiccms/models/connection.rb