Sha256: c18f0a3375668c4f21b1a9b3bd1ed5275231884472153e60763431771d19ddad

Contents?: true

Size: 844 Bytes

Versions: 19

Compression:

Stored size: 844 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 service_provided_by?(snac)
    authority = LocalAuthority.find_by_snac(snac)
    authority && authority.provides_service?(lgsl_code)
  end

  def whole_body
    self.introduction
  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
govuk_content_models-37.0.0 app/models/local_transaction_edition.rb
govuk_content_models-36.0.0 app/models/local_transaction_edition.rb
govuk_content_models-35.0.1 app/models/local_transaction_edition.rb
govuk_content_models-35.0.0 app/models/local_transaction_edition.rb
govuk_content_models-34.0.0 app/models/local_transaction_edition.rb
govuk_content_models-33.0.0 app/models/local_transaction_edition.rb
govuk_content_models-32.3.1 app/models/local_transaction_edition.rb
govuk_content_models-32.3.0 app/models/local_transaction_edition.rb
govuk_content_models-32.2.0 app/models/local_transaction_edition.rb
govuk_content_models-32.1.0 app/models/local_transaction_edition.rb
govuk_content_models-32.0.0 app/models/local_transaction_edition.rb
govuk_content_models-31.4.0 app/models/local_transaction_edition.rb
govuk_content_models-31.3.0 app/models/local_transaction_edition.rb
govuk_content_models-31.2.2 app/models/local_transaction_edition.rb
govuk_content_models-31.2.1 app/models/local_transaction_edition.rb
govuk_content_models-31.2.0 app/models/local_transaction_edition.rb
govuk_content_models-31.1.0 app/models/local_transaction_edition.rb
govuk_content_models-31.0.0 app/models/local_transaction_edition.rb
govuk_content_models-30.0.0 app/models/local_transaction_edition.rb