Sha256: c625ad85bb43dc7bc5561c5831227b01beb6eab7c3d479b92534cdb6c06fcb0d

Contents?: true

Size: 917 Bytes

Versions: 11

Compression:

Stored size: 917 Bytes

Contents

require "active_record"

module RailsConnector

  # Abstract base class for Comment.
  #
  # Objects do only have comments if the addon <tt>:comments</tt> is enabled
  # and the module {Commentable} is thereby included.
  #
  # A comment must have a name, email, subject, and body.
  class DefaultComment < ActiveRecord::Base
    self.abstract_class = true

    belongs_to :obj

    validates_presence_of :name, :message => I18n.t(:"rails_connector.models.comment.name_missing")
    validates_presence_of :body, :message => I18n.t(:"rails_connector.models.comment.body_missing")
    validates_presence_of :subject, :message => I18n.t(:"rails_connector.models.comment.subject_missing")

    EMAIL_FORMAT = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i

    validates_format_of(
      :email,
      :with => EMAIL_FORMAT,
      :message => I18n.t(:"rails_connector.models.comment.email_format_invalid")
    )
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
infopark_rails_connector-6.8.0.529.114081979 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.518.30999728 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.515.34928522 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.498.46559598 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.480.261594408 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.444.171626367 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.406.131718077 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.356.19698103 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.348.160665197 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.328.4a753fc app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.322.c003f11 app/models/rails_connector/default_comment.rb