Sha256: 91fe19233a887e61d2a1e89b202375d82981dd0d2cc6fb098d2cbfb373f68272

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

# Business License 是中国的工商营业执照。

class Unidom::Certificate::China::BusinessLicense < Unidom::Certificate::China::ApplicationRecord

  FORMAT_VALIDATION_REGEX = /\A\d{15}\z/

  self.table_name = 'unidom_china_business_licenses'

  include Unidom::Common::Concerns::ModelExtension
  include Unidom::Certificate::Concerns::AsCertification

  validates :registration_number, presence: true, length: { is: columns_hash['registration_number'].limit }, numericality: { integer_only: true }, format: self::FORMAT_VALIDATION_REGEX

  validates :address, presence: true, length: { in: 2..columns_hash['address'].limit }
  validates :name,    presence: true, length: { in: 2..columns_hash['name'].limit    }

  validates :legal_representative_name, presence:    true, length: { in: 2..columns_hash['legal_representative_name'].limit }
  validates :issuing_authority_name,    allow_blank: true, length: { in: 2..columns_hash['issuing_authority_name'].limit    }

  scope :registration_number_is, ->(registration_number) { where registration_number: registration_number }

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unidom-certificate-china-1.2.3 app/models/unidom/certificate/china/business_license.rb
unidom-certificate-china-1.2.2 app/models/unidom/certificate/china/business_license.rb
unidom-certificate-china-1.2.1 app/models/unidom/certificate/china/business_license.rb
unidom-certificate-china-1.2 app/models/unidom/certificate/china/business_license.rb