Sha256: a31b74835c604770d67a2acffb7383d890af8fc9f190b93e28b9969f725992b6

Contents?: true

Size: 969 Bytes

Versions: 13

Compression:

Stored size: 969 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")
    )

    attr_accessible :name, :body, :subject, :email
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
infopark_rails_connector-6.9.1.3.22208381 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.9.0.3.197272233 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.3.174.51542603 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.3.115.227021242 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.3.73.75172665 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.3.2.153416031 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.3.67.110847540 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.3.1.23895778 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.2.36.82613853 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.2.7.128454143 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.1.26.236500544 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.1 app/models/rails_connector/default_comment.rb
infopark_rails_connector-6.8.0.539.93842523 app/models/rails_connector/default_comment.rb