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.7.5 lib/classiccms/models/connection.rb
classiccms-0.7.4 lib/classiccms/models/connection.rb
classiccms-0.7.3 lib/classiccms/models/connection.rb
classiccms-0.7.2 lib/classiccms/models/connection.rb
classiccms-0.7.1 lib/classiccms/models/connection.rb
classiccms-0.7.0 lib/classiccms/models/connection.rb
classiccms-0.6.9 lib/classiccms/models/connection.rb
classiccms-0.6.8 lib/classiccms/models/connection.rb
classiccms-0.6.7 lib/classiccms/models/connection.rb
classiccms-0.6.6 lib/classiccms/models/connection.rb
classiccms-0.6.5 lib/classiccms/models/connection.rb
classiccms-0.6.4 lib/classiccms/models/connection.rb
classiccms-0.6.3 lib/classiccms/models/connection.rb
classiccms-0.6.2 lib/classiccms/models/connection.rb
classiccms-0.6.1 lib/classiccms/models/connection.rb
classiccms-0.6.0 lib/classiccms/models/connection.rb
classiccms-0.5.17 lib/classiccms/models/connection.rb
classiccms-0.5.16 lib/classiccms/models/connection.rb
classiccms-0.5.15 lib/classiccms/models/connection.rb
classiccms-0.5.14 lib/classiccms/models/connection.rb