Sha256: b0cbe3992bec47d5c08c928431ade20167244510ba9d7ffe4f82c964a0e47d3f

Contents?: true

Size: 915 Bytes

Versions: 21

Compression:

Stored size: 915 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

21 entries across 21 versions & 1 rubygems

Version Path
infopark_rails_connector-6.8.0.210.ed204b0 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.110.6570b45 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.72.d18d096 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.23.da7f96b app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.16.def5e85 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.15.a24f5ff app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.891.647580e app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.889.d503e42 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.883.f5f063b app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.884.4bd86e6 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.869.9609b39 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.856.8c0fec5 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.809.bdfa8c3 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.785.05d4af9 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.744.99f67fc app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.720.44fbabd app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.713.e5c3150 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.681.7c84f4a app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.663.ceecdee app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.beta.200.650.7c93155 app/models/rails_connector/default_comment.rb