Sha256: 9586370254e4adfc010563ab9fa3f92c73a9e257f012a3f806ba15ce7b5d576d
Contents?: true
Size: 885 Bytes
Versions: 18
Compression:
Stored size: 885 Bytes
Contents
class Contact include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming attr_accessor :name, :email, :subject, :body validates_presence_of :name, message: "#{I18n.t('model.attributes.name')} #{I18n.t('activerecord.errors.messages.blank')}" VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates_format_of :email, :with => VALID_EMAIL_REGEX, message: "#{I18n.t('model.attributes.email')} #{I18n.t('activerecord.errors.messages.invalid')}" validates_presence_of :body, message: "#{I18n.t('model.attributes.body')} #{I18n.t('activerecord.errors.messages.blank')}" def initialize(attributes = {}) attributes.each do |name, value| send("#{name}=", value) end end def self.display_name 'Correo' end def self.get_attribute_label(label) return label end def persisted? false end end
Version data entries
18 entries across 18 versions & 1 rubygems