Sha256: 78e5eaad38cd369d7ad5c4924cc97095ca3309f8d4cf62b90b1202d58f9a49ba

Contents?: true

Size: 683 Bytes

Versions: 5

Compression:

Stored size: 683 Bytes

Contents

module Concernz
  module AstronomicalObject
    extend ActiveSupport::Concern
    included do
      self.primary_key = 'astronomical_object_id'

      # AstronomicalObject is involved in Orbit and Orbit is around AstronomicalObject
      belongs_to :center_via_orbit, :class_name => 'AstronomicalObject', :foreign_key => :orbit_center_astronomical_object_id

      # Orbit is around AstronomicalObject and Orbit involves AstronomicalObject
      has_many :astronomical_objects_via_orbit, :class_name => 'AstronomicalObject', :foreign_key => :orbit_center_astronomical_object_id, :dependent => :destroy

      validates :astronomical_object_code, :presence => true
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activefacts-examples-1.9.9 rails/models/Astronomy.models
activefacts-examples-1.9.8 rails/models/Astronomy.models
activefacts-examples-1.8.0 rails/models/Astronomy.models
activefacts-examples-1.7.2 rails/models/Astronomy.models
activefacts-examples-1.7.1 rails/models/Astronomy.models