Class: DcPart

Inherits:
Object
  • Object
show all
Includes:
DcPieceConcern
Defined in:
app/models/dc_part.rb

Overview

Mongoid::Document model for dc_part embedded documents.

DcPart model is used for embedding parts of final document into other models. It declares fields which may be used in various scenarios. For example:

  • part of page which is visible to all users and part only to registered users

  • list of pictures or attachments which belong to document

-

DcPart model inherits its definition from DcPiece model, but adds policy_id field to definition. Policy_id field may be used where site policy must be taken into account when rendering part.

Instance Method Summary collapse

Instance Method Details

#do_before_saveObject

Implementation of before_save callback.



52
53
54
55
56
# File 'app/models/dc_part.rb', line 52

def do_before_save
  if self.link.blank?
    self.link = self.name.strip.downcase.gsub(' ','-')
  end
end