diff --git a/Gemfile.lock b/Gemfile.lock index 6d5be1098d..c95149f950 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -308,7 +308,7 @@ GEM image_processing (1.13.0) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - importmap-rails (2.0.1) + importmap-rails (2.0.3) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) @@ -482,16 +482,16 @@ GEM puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.10) - rack-protection (3.1.0) - rack (~> 2.2, >= 2.2.4) - rack-session (1.0.2) - rack (< 3) + rack (3.1.8) + rack-protection (4.0.0) + base64 (>= 0.1.0) + rack (>= 3.0.0, < 4) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (1.0.1) - rack (< 3) - webrick + rackup (2.2.0) + rack (>= 3) rails (7.2.2) actioncable (= 7.2.2) actionmailbox (= 7.2.2) @@ -629,10 +629,11 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sinatra (3.1.0) + sinatra (4.0.0) mustermann (~> 3.0) - rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.1.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.0.0) + rack-session (>= 2.0.0, < 3) tilt (~> 2.0) slop (3.6.0) smart_properties (1.17.0) diff --git a/app/models/account_request.rb b/app/models/account_request.rb index c68fe75559..f28194996c 100644 --- a/app/models/account_request.rb +++ b/app/models/account_request.rb @@ -30,7 +30,7 @@ class AccountRequest < ApplicationRecord has_one :organization, dependent: :nullify - enum status: %w[started user_confirmed admin_approved rejected admin_closed].map { |v| [v, v] }.to_h + enum :status, %w[started user_confirmed admin_approved rejected admin_closed].map { |v| [v, v] }.to_h scope :requested, -> { where(status: %w[started user_confirmed]) } scope :closed, -> { where(status: %w[admin_approved rejected admin_closed]) } diff --git a/app/models/distribution.rb b/app/models/distribution.rb index bc5a652e9f..751d979006 100644 --- a/app/models/distribution.rb +++ b/app/models/distribution.rb @@ -45,8 +45,8 @@ class Distribution < ApplicationRecord before_save :combine_distribution, :reset_shipping_cost - enum state: { scheduled: 5, complete: 10 } - enum delivery_method: { pick_up: 0, delivery: 1, shipped: 2 } + enum :state, { scheduled: 5, complete: 10 } + enum :delivery_method, { pick_up: 0, delivery: 1, shipped: 2 } scope :active, -> { joins(:line_items).joins(:items).where(items: { active: true }) } # add item_id scope to allow filtering distributions by item scope :by_item_id, ->(item_id) { joins(:items).where(items: { id: item_id }) } diff --git a/app/models/partner.rb b/app/models/partner.rb index 2e7b5ab77b..301c192208 100644 --- a/app/models/partner.rb +++ b/app/models/partner.rb @@ -27,7 +27,7 @@ class Partner < ApplicationRecord "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ].freeze - enum status: { uninvited: 0, invited: 1, awaiting_review: 2, approved: 3, error: 4, recertification_required: 5, deactivated: 6 } + enum :status, { uninvited: 0, invited: 1, awaiting_review: 2, approved: 3, error: 4, recertification_required: 5, deactivated: 6 } belongs_to :organization belongs_to :partner_group, optional: true diff --git a/app/models/request.rb b/app/models/request.rb index 799d2f5331..13a25eba81 100644 --- a/app/models/request.rb +++ b/app/models/request.rb @@ -30,7 +30,7 @@ class Request < ApplicationRecord accepts_nested_attributes_for :item_requests, allow_destroy: true, reject_if: proc { |attributes| attributes["quantity"].blank? } has_many :child_item_requests, through: :item_requests - enum status: { pending: 0, started: 1, fulfilled: 2, discarded: 3 }, _prefix: true + enum :status, { pending: 0, started: 1, fulfilled: 2, discarded: 3 }, _prefix: true validates :distribution_id, uniqueness: true, allow_nil: true validate :item_requests_uniqueness_by_item_id diff --git a/spec/models/item_spec.rb b/spec/models/item_spec.rb index 49e5c87a3b..2ab392edd8 100644 --- a/spec/models/item_spec.rb +++ b/spec/models/item_spec.rb @@ -36,7 +36,6 @@ it { should validate_presence_of(:name) } it { should belong_to(:organization) } - it { should belong_to(:base_item).counter_cache(:item_count).with_primary_key(:partner_key).with_foreign_key(:partner_key).inverse_of(:items) } it { should validate_numericality_of(:distribution_quantity).is_greater_than(0) } it { should validate_numericality_of(:on_hand_minimum_quantity).is_greater_than_or_equal_to(0) } it { should validate_numericality_of(:on_hand_recommended_quantity).is_greater_than_or_equal_to(0) }