Sha256: 0660aabd3d3a775977ae482afd3ff74648fc531b63d104374e713453e8146f42

Contents?: true

Size: 698 Bytes

Versions: 17

Compression:

Stored size: 698 Bytes

Contents

require "local_service"
require "edition"

class LocalTransactionEdition < Edition
  field :lgsl_code, type: Integer
  field :lgil_override, type: Integer
  field :introduction, type: String
  field :more_information, type: String
  field :need_to_know, type: String

  GOVSPEAK_FIELDS = [:introduction, :more_information, :need_to_know]

  validate :valid_lgsl_code

  def valid_lgsl_code
    if ! self.service
      errors.add(:lgsl_code, "#{lgsl_code} not recognised")
    end
  end

  def format_name
    "Local transaction"
  end

  def search_format
    "transaction"
  end

  def service
    LocalService.find_by_lgsl_code(lgsl_code)
  end

  def whole_body
    self.introduction
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
govuk_content_models-44.2.1 app/models/local_transaction_edition.rb
govuk_content_models-44.2.0 app/models/local_transaction_edition.rb
govuk_content_models-44.1.0 app/models/local_transaction_edition.rb
govuk_content_models-44.0.1 app/models/local_transaction_edition.rb
govuk_content_models-44.0.0 app/models/local_transaction_edition.rb
govuk_content_models-43.2.0 app/models/local_transaction_edition.rb
govuk_content_models-43.1.0 app/models/local_transaction_edition.rb
govuk_content_models-43.0.1 app/models/local_transaction_edition.rb
govuk_content_models-43.0.0 app/models/local_transaction_edition.rb
govuk_content_models-42.1.0 app/models/local_transaction_edition.rb
govuk_content_models-42.0.1 app/models/local_transaction_edition.rb
govuk_content_models-42.0.0 app/models/local_transaction_edition.rb
govuk_content_models-41.1.1 app/models/local_transaction_edition.rb
govuk_content_models-41.1.0 app/models/local_transaction_edition.rb
govuk_content_models-41.0.0 app/models/local_transaction_edition.rb
govuk_content_models-40.0.0 app/models/local_transaction_edition.rb
govuk_content_models-39.0.0 app/models/local_transaction_edition.rb