Sha256: 8ca38612483df066c13c8357c30a666722df39e794bc7d57a321b3b0830b840d

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

class ContactsForm < ApplicationForm
  validates :first_name, length: { maximum: 130 }, presence: true
  validates :last_name, length: { maximum: 130 }, presence: true

  validates :email, email: true, length: { maximum: 130 }, presence: true
  validates :company_name, length: { maximum: 130 }, allow_blank: true

  validates :content, length: { maximum: 1000 }, allow_blank: true

  attribute :first_name,   String
  attribute :last_name,    String
  attribute :email,        String
  attribute :company_name, String
  attribute :content,      String
  attribute :remote_ip,    String

  attribute :reason_id,      Integer
  attribute :source_type_id, Integer, default: 0, writer: :private

  def submit
    TranslationCms::Api::Report.create(attributes)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/forms/contacts_form.rb