Class: DcPart
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
-
#do_before_save ⇒ Object
Implementation of before_save callback.
Instance Method Details
#do_before_save ⇒ Object
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 |