• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / bibdata / b3c4a532-5da0-46f8-9c20-20018605a028

21 Mar 2025 08:11PM UTC coverage: 42.257% (-49.9%) from 92.185%
b3c4a532-5da0-46f8-9c20-20018605a028

push

circleci

sandbergja
Move various gems from the default Gemfile group to a more appropriate group

1599 of 3784 relevant lines covered (42.26%)

2.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/app/models/holding_location.rb
1
# frozen_string_literal: true
2

3
class HoldingLocation < ActiveRecord::Base
1✔
4
  include Coded
1✔
5
  include WithLibrary
1✔
6

7
  # TODO: Remove after migrating to non-prefixed tables
8
  self.table_name_prefix = 'locations_'
1✔
9

10
  belongs_to :holding_library, class_name: 'Library', optional: true
1✔
11

12
  has_and_belongs_to_many :delivery_locations, -> { distinct },
1✔
13
                          class_name: 'DeliveryLocation',
14
                          join_table: 'locations_holdings_delivery',
15
                          foreign_key: 'locations_delivery_location_id',
16
                          association_foreign_key: 'locations_holding_location_id'
17

18
  validates :aeon_location, :recap_electronic_delivery_location, :open,
1✔
19
            :requestable, :always_requestable, :circulates, inclusion: { in: [true, false] }
20

21
  after_initialize :associate_non_staff_only_delivery_locations, if: :new_record?
1✔
22
  after_create :set_defaults
1✔
23

24
  private
1✔
25

26
    def set_defaults
1✔
27
      self.aeon_location = false if aeon_location.blank?
10✔
28
      self.recap_electronic_delivery_location = false if recap_electronic_delivery_location.blank?
10✔
29
      self.open = true if open.blank?
10✔
30
      self.requestable = true if requestable.blank?
10✔
31
      self.always_requestable = false if always_requestable.blank?
10✔
32
      self.circulates = true if circulates.blank?
10✔
33
    end
34

35
    def associate_non_staff_only_delivery_locations
1✔
36
      DeliveryLocation.all.reject(&:staff_only?).each do |public_dl|
10✔
37
        delivery_locations << public_dl
×
38
      end
39
    end
40
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc