osunyorg/admin

View on GitHub
app/models/education/program/with_locations.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Education::Program::WithLocations
  extend ActiveSupport::Concern

  included do
    has_and_belongs_to_many :administration_locations,
                            class_name: 'Administration::Location',
                            foreign_key: :education_program_id,
                            association_foreign_key: :administration_location_id
                            alias_method :locations, :administration_locations
  end

  def has_administration_locations?
    locations.any?
  end
end