Sha256: f6b4db27e46bb4aba1d86510f3cdebfff54c2cdd9cd971312d37a9f47243a731

Contents?: true

Size: 1.64 KB

Versions: 5

Compression:

Stored size: 1.64 KB

Contents

require 'activefacts/api'

module ::RedundantDependency

  class AddressId < AutoCounter
    value_type 
    one_to_one :address                         # See Address.address_id
  end

  class DistrictNumber < SignedInteger
    value_type :length => 32
  end

  class PoliticianId < AutoCounter
    value_type 
    one_to_one :politician                      # See Politician.politician_id
  end

  class PostalCode < SignedInteger
    value_type :length => 32
  end

  class StateOrProvinceId < AutoCounter
    value_type 
    one_to_one :state_or_province               # See StateOrProvince.state_or_province_id
  end

  class Address
    identified_by :address_id
    one_to_one :address_id, :mandatory => true  # See AddressId.address
    has_one :legislative_district               # See LegislativeDistrict.all_address
    has_one :postal_code                        # See PostalCode.all_address
    has_one :state_or_province                  # See StateOrProvince.all_address
  end

  class Politician
    identified_by :politician_id
    one_to_one :politician_id, :mandatory => true  # See PoliticianId.politician
  end

  class StateOrProvince
    identified_by :state_or_province_id
    one_to_one :state_or_province_id, :mandatory => true  # See StateOrProvinceId.state_or_province
  end

  class LegislativeDistrict
    identified_by :district_number, :state_or_province
    has_one :district_number, :mandatory => true  # See DistrictNumber.all_legislative_district
    one_to_one :politician, :mandatory => true  # See Politician.legislative_district
    has_one :state_or_province, :mandatory => true  # See StateOrProvince.all_legislative_district
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activefacts-examples-1.9.9 ruby/RedundantDependency.rb
activefacts-examples-1.9.8 ruby/RedundantDependency.rb
activefacts-examples-1.8.0 ruby/RedundantDependency.rb
activefacts-examples-1.7.2 ruby/RedundantDependency.rb
activefacts-examples-1.7.1 ruby/RedundantDependency.rb