noesya/osuny

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

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
module Education::School::WithLocations
  extend ActiveSupport::Concern

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

  def has_administration_locations?
    locations.any?
  end
end