Class | Comment
In: | app/models/comment.rb
Parent: | DaText

Copyright (c) 2006 Logica

### Methods

after_create before_validation_on_create validate_on_create

### Public Instance methods

after_create()

[Source]

        # File app/models/comment.rb, line 46
    46:     def after_create
    47:       Notification.find_or_create(self.page, self.user, Page.name)
    48:     end

before_validation_on_create()

Set some redundant properties

[Source]

        # File app/models/comment.rb, line 28
    28:     def before_validation_on_create
    29:       if self.version.nil?
    30:         if self.page.current_version
    31:           self.version = self.page.current_version
    32:         end
    33:       end
    34:       unless self.version.nil?
    35:         self.page = self.version.page
    36:      end
    37:      self.site = self.page.site
    38:     end

validate_on_create()

[Source]

        # File app/models/comment.rb, line 40
    40:     def validate_on_create
    41:       if self.version.nil?
    42:         errors.add("Cannot comment on new pages that are in the process of being created (not checked in yet). Comments would be left dangling on undo checkout.")
    43:       end
    44:     end

[Validate]