From a373d629568c2cbfcb4aba428584ef5bea447a82 Mon Sep 17 00:00:00 2001 From: Ancor Cruz Date: Thu, 28 Nov 2024 11:53:04 +0000 Subject: [PATCH 1/4] update rails to 7.2 --- Gemfile | 2 +- Gemfile.lock | 170 +++++++++++++++++++++++++-------------------------- 2 files changed, 85 insertions(+), 87 deletions(-) diff --git a/Gemfile b/Gemfile index 1918812c86f..413fc74c7b6 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem "bootsnap", require: false gem "clockwork", require: false gem "parallel" gem "puma", "~> 6.4" -gem "rails", "~> 7.1.3.4" +gem "rails", "~> 7.2" gem "redis" gem "sidekiq" gem "dry-validation" diff --git a/Gemfile.lock b/Gemfile.lock index a3958ac23d5..6a3a753d366 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,57 +36,52 @@ GEM specs: aasm (5.5.0) concurrent-ruby (~> 1.0) - actioncable (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) + actioncable (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.1.3.4) - actionpack (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activesupport (= 7.1.3.4) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp + actionmailbox (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) + mail (>= 2.8.0) + actionmailer (7.2.2) + actionpack (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activesupport (= 7.2.2) + mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (7.2.2) + actionview (= 7.2.2) + activesupport (= 7.2.2) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.4) - actionpack (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + useragent (~> 0.16) + actiontext (7.2.2) + actionpack (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + actionview (7.2.2) + activesupport (= 7.2.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3.4) - activesupport (= 7.1.3.4) + activejob (7.2.2) + activesupport (= 7.2.2) globalid (>= 0.3.6) activejob-traceable (0.4.2) activejob @@ -94,28 +89,30 @@ GEM activejob-uniqueness (0.3.2) activejob (>= 4.2, < 7.3) redlock (>= 2.0, < 3) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (7.2.2) + activesupport (= 7.2.2) + activerecord (7.2.2) + activemodel (= 7.2.2) + activesupport (= 7.2.2) timeout (>= 0.4.0) - activestorage (7.1.3.4) - actionpack (= 7.1.3.4) - activejob (= 7.1.3.4) - activerecord (= 7.1.3.4) - activesupport (= 7.1.3.4) + activestorage (7.2.2) + actionpack (= 7.2.2) + activejob (= 7.2.2) + activerecord (= 7.2.2) + activesupport (= 7.2.2) marcel (~> 1.0) - activesupport (7.1.3.4) + activesupport (7.2.2) base64 + benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) adyen-ruby-api-library (7.3.1) @@ -147,6 +144,7 @@ GEM aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) bcrypt (3.1.20) + benchmark (0.4.0) bigdecimal (3.1.8) bootsnap (1.18.4) msgpack (~> 1.2) @@ -185,7 +183,7 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - date (3.3.4) + date (3.4.0) debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) @@ -321,7 +319,7 @@ GEM i18n (1.14.6) concurrent-ruby (~> 1.0) io-console (0.7.2) - irb (1.14.0) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) jmespath (1.6.2) @@ -362,7 +360,7 @@ GEM railties (>= 4) request_store (~> 1.0) logstash-event (1.2.02) - loofah (2.22.0) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) lumberjack (1.2.10) @@ -375,7 +373,7 @@ GEM method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.7) - minitest (5.25.1) + minitest (5.25.2) monetize (1.13.0) money (~> 6.12) money (6.19.0) @@ -392,7 +390,7 @@ GEM multipart-post (2.4.1) mutex_m (0.3.0) nenv (0.3.0) - net-imap (0.4.14) + net-imap (0.5.1) date net-protocol net-pop (0.1.2) @@ -402,7 +400,7 @@ GEM net-smtp (0.5.0) net-protocol newrelic_rpm (9.12.0) - nio4r (2.7.3) + nio4r (2.7.4) nokogiri (1.16.7-aarch64-linux) racc (~> 1.4) nokogiri (1.16.7-arm64-darwin) @@ -634,36 +632,35 @@ GEM pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.2) + psych (5.2.0) stringio public_suffix (5.1.1) puma (6.4.3) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.9) + rack (3.1.8) rack-cors (1.1.1) rack (>= 2.0.0) - rack-session (1.0.2) - rack (< 3) + rack-session (2.0.0) + rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (1.0.0) - rack (< 3) - webrick - rails (7.1.3.4) - actioncable (= 7.1.3.4) - actionmailbox (= 7.1.3.4) - actionmailer (= 7.1.3.4) - actionpack (= 7.1.3.4) - actiontext (= 7.1.3.4) - actionview (= 7.1.3.4) - activejob (= 7.1.3.4) - activemodel (= 7.1.3.4) - activerecord (= 7.1.3.4) - activestorage (= 7.1.3.4) - activesupport (= 7.1.3.4) + rackup (2.2.1) + rack (>= 3) + rails (7.2.2) + actioncable (= 7.2.2) + actionmailbox (= 7.2.2) + actionmailer (= 7.2.2) + actionpack (= 7.2.2) + actiontext (= 7.2.2) + actionview (= 7.2.2) + activejob (= 7.2.2) + activemodel (= 7.2.2) + activerecord (= 7.2.2) + activestorage (= 7.2.2) + activesupport (= 7.2.2) bundler (>= 1.15.0) - railties (= 7.1.3.4) + railties (= 7.2.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -674,10 +671,10 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) - irb + railties (7.2.2) + actionpack (= 7.2.2) + activesupport (= 7.2.2) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) @@ -696,7 +693,7 @@ GEM rb_sys (0.9.102) rbs (3.6.1) logger - rdoc (6.7.0) + rdoc (6.8.1) psych (>= 4.0.0) redis (5.3.0) redis-client (>= 0.22.0) @@ -705,7 +702,7 @@ GEM redlock (2.0.6) redis-client (>= 0.14.1, < 1.0.0) regexp_parser (2.9.2) - reline (0.5.9) + reline (0.5.11) io-console (~> 0.5) representable (3.2.0) declarative (< 0.1.0) @@ -798,6 +795,7 @@ GEM scenic (1.8.0) activerecord (>= 4.0.0) railties (>= 4.0.0) + securerandom (0.3.2) sentry-rails (5.18.2) railties (>= 5.0) sentry-ruby (~> 5.18.2) @@ -857,14 +855,14 @@ GEM standard-performance (1.4.0) lint_roller (~> 1.1) rubocop-performance (~> 1.21.0) - stringio (3.1.1) + stringio (3.1.2) stripe (6.5.0) strong_migrations (2.0.0) activerecord (>= 6.1) temple (0.8.2) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.3.1) + thor (1.3.2) tilt (2.0.11) timecop (0.9.10) timeout (0.4.2) @@ -877,6 +875,7 @@ GEM unaccent (0.4.0) unicode-display_width (2.5.0) uniform_notifier (1.16.0) + useragent (0.16.10) valvat (1.4.4) rexml (>= 3.2.7, < 4.0.0) version_gem (1.1.4) @@ -888,14 +887,13 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.2) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) with_advisory_lock (5.1.0) activerecord (>= 6.1) zeitwerk (>= 2.6) - zeitwerk (2.6.17) + zeitwerk (2.7.1) PLATFORMS aarch64-linux @@ -963,7 +961,7 @@ DEPENDENCIES pg puma (~> 6.4) rack-cors - rails (~> 7.1.3.4) + rails (~> 7.2) ransack (~> 4.1.0) redis rspec-graphql_matchers From 1e2be8eefafdab0fd2ec331e0dc4be4103b6a9f5 Mon Sep 17 00:00:00 2001 From: Ancor Cruz Date: Thu, 28 Nov 2024 12:55:39 +0000 Subject: [PATCH 2/4] update ransack to 4.2.x for Rails 7.2 support --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 413fc74c7b6..7f5f04e26fc 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,7 @@ gem "discard", "~> 1.2" gem "kaminari-activerecord" gem "paper_trail", "~> 15.1" gem "pg" -gem "ransack", "~> 4.1.0" +gem "ransack", "~> 4.2.0" gem "scenic" gem "with_advisory_lock" gem "strong_migrations" diff --git a/Gemfile.lock b/Gemfile.lock index 6a3a753d366..91ef86be88a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -683,7 +683,7 @@ GEM rake (13.2.1) rake-compiler (1.2.8) rake - ransack (4.1.1) + ransack (4.2.1) activerecord (>= 6.1.5) activesupport (>= 6.1.5) i18n @@ -962,7 +962,7 @@ DEPENDENCIES puma (~> 6.4) rack-cors rails (~> 7.2) - ransack (~> 4.1.0) + ransack (~> 4.2.0) redis rspec-graphql_matchers rspec-rails From 5a0e3d55baaad790e4925f2300d39772002bd915 Mon Sep 17 00:00:00 2001 From: Ancor Cruz Date: Thu, 28 Nov 2024 16:08:30 +0000 Subject: [PATCH 3/4] fix deprectation warning on enums for rails 8 --- app/models/adjusted_fee.rb | 2 +- app/models/applied_coupon.rb | 4 ++-- app/models/billable_metric.rb | 6 +++--- app/models/charge.rb | 4 ++-- app/models/commitment.rb | 2 +- app/models/coupon.rb | 8 ++++---- app/models/credit_note.rb | 8 ++++---- app/models/customer.rb | 4 ++-- app/models/data_export.rb | 4 ++-- app/models/error_detail.rb | 2 +- app/models/fee.rb | 4 ++-- .../base_collection_mapping.rb | 2 +- app/models/integration_item.rb | 2 +- app/models/integration_resource.rb | 2 +- app/models/invite.rb | 4 ++-- app/models/invoice.rb | 6 +++--- app/models/invoice_subscription.rb | 2 +- app/models/membership.rb | 4 ++-- app/models/organization.rb | 2 +- app/models/payment_request.rb | 2 +- app/models/plan.rb | 2 +- app/models/recurring_transaction_rule.rb | 6 +++--- app/models/subscription.rb | 4 ++-- app/models/wallet.rb | 2 +- app/models/wallet_transaction.rb | 8 ++++---- app/models/webhook.rb | 2 +- app/models/webhook_endpoint.rb | 2 +- 27 files changed, 50 insertions(+), 50 deletions(-) diff --git a/app/models/adjusted_fee.rb b/app/models/adjusted_fee.rb index 37ca7ca19e5..27397df3651 100644 --- a/app/models/adjusted_fee.rb +++ b/app/models/adjusted_fee.rb @@ -13,7 +13,7 @@ class AdjustedFee < ApplicationRecord :adjusted_amount ].freeze - enum fee_type: Fee::FEE_TYPES + enum :fee_type, Fee::FEE_TYPES def adjusted_display_name? adjusted_units.blank? && adjusted_amount.blank? diff --git a/app/models/applied_coupon.rb b/app/models/applied_coupon.rb index 755e7dd845a..8eb613bcdf1 100644 --- a/app/models/applied_coupon.rb +++ b/app/models/applied_coupon.rb @@ -20,8 +20,8 @@ class AppliedCoupon < ApplicationRecord :forever ].freeze - enum status: STATUSES - enum frequency: FREQUENCIES + enum :status, STATUSES + enum :frequency, FREQUENCIES monetize :amount_cents, disable_validation: true, allow_nil: true diff --git a/app/models/billable_metric.rb b/app/models/billable_metric.rb index 639cecbfb1d..9cebfaa7ab8 100644 --- a/app/models/billable_metric.rb +++ b/app/models/billable_metric.rb @@ -31,9 +31,9 @@ class BillableMetric < ApplicationRecord WEIGHTED_INTERVAL = {seconds: "seconds"}.freeze - enum aggregation_type: AGGREGATION_TYPES - enum rounding_function: ROUNDING_FUNCTIONS - enum weighted_interval: WEIGHTED_INTERVAL + enum :aggregation_type, AGGREGATION_TYPES + enum :rounding_function, ROUNDING_FUNCTIONS + enum :weighted_interval, WEIGHTED_INTERVAL validate :validate_recurring validate :validate_expression diff --git a/app/models/charge.rb b/app/models/charge.rb index 170ef8c561d..f35ab817aad 100644 --- a/app/models/charge.rb +++ b/app/models/charge.rb @@ -31,8 +31,8 @@ class Charge < ApplicationRecord REGROUPING_PAID_FEES_OPTIONS = %i[invoice].freeze - enum charge_model: CHARGE_MODELS - enum regroup_paid_fees: REGROUPING_PAID_FEES_OPTIONS + enum :charge_model, CHARGE_MODELS + enum :regroup_paid_fees, REGROUPING_PAID_FEES_OPTIONS validate :validate_amount, if: -> { standard? } validate :validate_graduated, if: -> { graduated? } diff --git a/app/models/commitment.rb b/app/models/commitment.rb index 4d9d2f11f2a..07065db211d 100644 --- a/app/models/commitment.rb +++ b/app/models/commitment.rb @@ -9,7 +9,7 @@ class Commitment < ApplicationRecord minimum_commitment: 0 }.freeze - enum commitment_type: COMMITMENT_TYPES + enum :commitment_type, COMMITMENT_TYPES monetize :amount_cents, disable_validation: true, allow_nil: true diff --git a/app/models/coupon.rb b/app/models/coupon.rb index 5f648586f40..8d272ec2127 100644 --- a/app/models/coupon.rb +++ b/app/models/coupon.rb @@ -35,10 +35,10 @@ class Coupon < ApplicationRecord :forever ].freeze - enum status: STATUSES - enum expiration: EXPIRATION_TYPES - enum coupon_type: COUPON_TYPES - enum frequency: FREQUENCIES + enum :status, STATUSES + enum :expiration, EXPIRATION_TYPES + enum :coupon_type, COUPON_TYPES + enum :frequency, FREQUENCIES monetize :amount_cents, disable_validation: true, allow_nil: true diff --git a/app/models/credit_note.rb b/app/models/credit_note.rb index 900369e6e60..5fd039a74e2 100644 --- a/app/models/credit_note.rb +++ b/app/models/credit_note.rb @@ -48,10 +48,10 @@ class CreditNote < ApplicationRecord REASON = %i[duplicated_charge product_unsatisfactory order_change order_cancellation fraudulent_charge other].freeze STATUS = %i[draft finalized].freeze - enum credit_status: CREDIT_STATUS - enum refund_status: REFUND_STATUS - enum reason: REASON - enum status: STATUS + enum :credit_status, CREDIT_STATUS + enum :refund_status, REFUND_STATUS + enum :reason, REASON + enum :status, STATUS sequenced scope: ->(credit_note) { CreditNote.where(invoice_id: credit_note.invoice_id) }, lock_key: ->(credit_note) { credit_note.invoice_id } diff --git a/app/models/customer.rb b/app/models/customer.rb index 3711d160243..c714c2fe978 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -21,9 +21,9 @@ class Customer < ApplicationRecord }.freeze attribute :finalize_zero_amount_invoice, :integer - enum finalize_zero_amount_invoice: FINALIZE_ZERO_AMOUNT_INVOICE_OPTIONS, _prefix: :finalize_zero_amount_invoice + enum :finalize_zero_amount_invoice, FINALIZE_ZERO_AMOUNT_INVOICE_OPTIONS, prefix: :finalize_zero_amount_invoice attribute :customer_type, :string - enum customer_type: CUSTOMER_TYPES, _prefix: :customer_type + enum :customer_type, CUSTOMER_TYPES, prefix: :customer_type before_save :ensure_slug diff --git a/app/models/data_export.rb b/app/models/data_export.rb index 930c286616e..f8eec7baf7c 100644 --- a/app/models/data_export.rb +++ b/app/models/data_export.rb @@ -16,8 +16,8 @@ class DataExport < ApplicationRecord validates :format, presence: true, inclusion: {in: EXPORT_FORMATS} validates :status, presence: true, inclusion: {in: STATUSES} - enum format: EXPORT_FORMATS - enum status: STATUSES + enum :format, EXPORT_FORMATS + enum :status, STATUSES delegate :user, to: :membership diff --git a/app/models/error_detail.rb b/app/models/error_detail.rb index ff1040c670f..ec87a980e68 100644 --- a/app/models/error_detail.rb +++ b/app/models/error_detail.rb @@ -9,7 +9,7 @@ class ErrorDetail < ApplicationRecord belongs_to :organization ERROR_CODES = %w[not_provided tax_error tax_voiding_error] - enum error_code: ERROR_CODES + enum :error_code, ERROR_CODES end # == Schema Information diff --git a/app/models/fee.rb b/app/models/fee.rb index c4624ccf796..c652f419108 100644 --- a/app/models/fee.rb +++ b/app/models/fee.rb @@ -41,8 +41,8 @@ class Fee < ApplicationRecord FEE_TYPES = %i[charge add_on subscription credit commitment].freeze PAYMENT_STATUS = %i[pending succeeded failed refunded].freeze - enum fee_type: FEE_TYPES - enum payment_status: PAYMENT_STATUS, _prefix: :payment + enum :fee_type, FEE_TYPES + enum :payment_status, PAYMENT_STATUS, prefix: :payment validates :amount_currency, inclusion: {in: currency_list} validates :units, numericality: {greated_than_or_equal_to: 0} diff --git a/app/models/integration_collection_mappings/base_collection_mapping.rb b/app/models/integration_collection_mappings/base_collection_mapping.rb index d6a6f97d635..f0a6fb8cacc 100644 --- a/app/models/integration_collection_mappings/base_collection_mapping.rb +++ b/app/models/integration_collection_mappings/base_collection_mapping.rb @@ -13,7 +13,7 @@ class BaseCollectionMapping < ApplicationRecord fallback_item coupon subscription_fee minimum_commitment tax prepaid_credit credit_note account ].freeze - enum mapping_type: MAPPING_TYPES + enum :mapping_type, MAPPING_TYPES validates :mapping_type, uniqueness: {scope: :integration_id} diff --git a/app/models/integration_item.rb b/app/models/integration_item.rb index 62ad5953b78..7ce3c565b37 100644 --- a/app/models/integration_item.rb +++ b/app/models/integration_item.rb @@ -11,7 +11,7 @@ class IntegrationItem < ApplicationRecord :account ].freeze - enum item_type: ITEM_TYPES + enum :item_type, ITEM_TYPES validates :external_id, presence: true, uniqueness: {scope: %i[integration_id item_type]} diff --git a/app/models/integration_resource.rb b/app/models/integration_resource.rb index ede09d04ff4..c3227343848 100644 --- a/app/models/integration_resource.rb +++ b/app/models/integration_resource.rb @@ -6,7 +6,7 @@ class IntegrationResource < ApplicationRecord RESOURCE_TYPES = %i[invoice sales_order_deprecated payment credit_note subscription].freeze - enum resource_type: RESOURCE_TYPES + enum :resource_type, RESOURCE_TYPES end # == Schema Information diff --git a/app/models/invite.rb b/app/models/invite.rb index 6a3337476ec..ae1694b2e9f 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -12,8 +12,8 @@ class Invite < ApplicationRecord revoked ].freeze - enum status: INVITE_STATUS - enum role: Membership::ROLES + enum :status, INVITE_STATUS + enum :role, Membership::ROLES validates :email, email: true validates :token, uniqueness: true diff --git a/app/models/invoice.rb b/app/models/invoice.rb index aaf81b09ae4..cb2e26c0162 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -67,9 +67,9 @@ class Invoice < ApplicationRecord STATUS = VISIBLE_STATUS.merge(INVISIBLE_STATUS).freeze GENERATED_INVOICE_STATUSES = %w[finalized closed].freeze - enum invoice_type: INVOICE_TYPES - enum payment_status: PAYMENT_STATUS, _prefix: :payment - enum status: STATUS + enum :invoice_type, INVOICE_TYPES + enum :payment_status, PAYMENT_STATUS, prefix: :payment + enum :status, STATUS aasm column: 'status', timestamps: true do state :generating diff --git a/app/models/invoice_subscription.rb b/app/models/invoice_subscription.rb index 3c1c38348c2..d02d467f16f 100644 --- a/app/models/invoice_subscription.rb +++ b/app/models/invoice_subscription.rb @@ -22,7 +22,7 @@ class InvoiceSubscription < ApplicationRecord progressive_billing: 'progressive_billing' }.freeze - enum invoicing_reason: INVOICING_REASONS + enum :invoicing_reason, INVOICING_REASONS scope :order_by_charges_to_datetime, lambda { diff --git a/app/models/membership.rb b/app/models/membership.rb index cc0b8e5be84..a898885e91e 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -19,8 +19,8 @@ class Membership < ApplicationRecord finance: 2 }.freeze - enum status: STATUSES - enum role: ROLES + enum :status, STATUSES + enum :role, ROLES validates :user_id, uniqueness: {conditions: -> { where(revoked_at: nil) }, scope: :organization_id} diff --git a/app/models/organization.rb b/app/models/organization.rb index f22bed69713..94a8ae0b257 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -64,7 +64,7 @@ class Organization < ApplicationRecord ].freeze PREMIUM_INTEGRATIONS = INTEGRATIONS - %w[anrok] - enum document_numbering: DOCUMENT_NUMBERINGS + enum :document_numbering, DOCUMENT_NUMBERINGS validates :country, country_code: true, unless: -> { country.nil? } validates :default_currency, inclusion: {in: currency_list} diff --git a/app/models/payment_request.rb b/app/models/payment_request.rb index 30cc2c80916..2d6352717c3 100644 --- a/app/models/payment_request.rb +++ b/app/models/payment_request.rb @@ -16,7 +16,7 @@ class PaymentRequest < ApplicationRecord PAYMENT_STATUS = %i[pending succeeded failed].freeze - enum payment_status: PAYMENT_STATUS, _prefix: :payment + enum :payment_status, PAYMENT_STATUS, prefix: :payment alias_attribute :total_amount_cents, :amount_cents alias_attribute :currency, :amount_currency diff --git a/app/models/plan.rb b/app/models/plan.rb index f5fb46514c4..a518377c9fd 100644 --- a/app/models/plan.rb +++ b/app/models/plan.rb @@ -32,7 +32,7 @@ class Plan < ApplicationRecord quarterly ].freeze - enum interval: INTERVALS + enum :interval, INTERVALS monetize :amount_cents diff --git a/app/models/recurring_transaction_rule.rb b/app/models/recurring_transaction_rule.rb index 66dff41bd2e..8cc01e0bff0 100644 --- a/app/models/recurring_transaction_rule.rb +++ b/app/models/recurring_transaction_rule.rb @@ -22,9 +22,9 @@ class RecurringTransactionRule < ApplicationRecord :threshold ].freeze - enum interval: INTERVALS - enum method: METHODS - enum trigger: TRIGGERS + enum :interval, INTERVALS + enum :method, METHODS + enum :trigger, TRIGGERS end # == Schema Information diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 71afc468e63..b2d1394e8a6 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -32,8 +32,8 @@ class Subscription < ApplicationRecord anniversary ].freeze - enum status: STATUSES - enum billing_time: BILLING_TIME + enum :status, STATUSES + enum :billing_time, BILLING_TIME scope :starting_in_the_future, -> { pending.where(previous_subscription: nil) } diff --git a/app/models/wallet.rb b/app/models/wallet.rb index 17eb08b8236..2764a103dc0 100644 --- a/app/models/wallet.rb +++ b/app/models/wallet.rb @@ -20,7 +20,7 @@ class Wallet < ApplicationRecord :terminated ].freeze - enum status: STATUSES + enum :status, STATUSES def mark_as_terminated!(timestamp = Time.zone.now) self.terminated_at ||= timestamp diff --git a/app/models/wallet_transaction.rb b/app/models/wallet_transaction.rb index 689a9796f91..00b6cfdfbec 100644 --- a/app/models/wallet_transaction.rb +++ b/app/models/wallet_transaction.rb @@ -32,10 +32,10 @@ class WalletTransaction < ApplicationRecord :threshold ].freeze - enum status: STATUSES - enum transaction_status: TRANSACTION_STATUSES - enum transaction_type: TRANSACTION_TYPES - enum source: SOURCES + enum :status, STATUSES + enum :transaction_status, TRANSACTION_STATUSES + enum :transaction_type, TRANSACTION_TYPES + enum :source, SOURCES scope :pending, -> { where(status: :pending) } end diff --git a/app/models/webhook.rb b/app/models/webhook.rb index 0d97c2fc434..d06fef48cb7 100644 --- a/app/models/webhook.rb +++ b/app/models/webhook.rb @@ -10,7 +10,7 @@ class Webhook < ApplicationRecord has_one :organization, through: :webhook_endpoint - enum status: STATUS + enum :status, STATUS def self.ransackable_attributes(_auth_object = nil) %w[id webhook_type] diff --git a/app/models/webhook_endpoint.rb b/app/models/webhook_endpoint.rb index f3474ab2b85..5d820e64c87 100644 --- a/app/models/webhook_endpoint.rb +++ b/app/models/webhook_endpoint.rb @@ -15,7 +15,7 @@ class WebhookEndpoint < ApplicationRecord validates :webhook_url, uniqueness: {scope: :organization_id} validate :max_webhook_endpoints, on: :create - enum signature_algo: SIGNATURE_ALGOS + enum :signature_algo, SIGNATURE_ALGOS def self.ransackable_attributes(_auth_object = nil) %w[webhook_url] From 8c881c842e14656243d59e77250375489f0c6b14 Mon Sep 17 00:00:00 2001 From: Ancor Cruz Date: Thu, 28 Nov 2024 16:40:41 +0000 Subject: [PATCH 4/4] update paper trail to latest version supporting rails 7.2 and 8.0 --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 7f5f04e26fc..3a312014b3c 100644 --- a/Gemfile +++ b/Gemfile @@ -29,7 +29,7 @@ gem "after_commit_everywhere" gem "clickhouse-activerecord", "~> 1.2.0" gem "discard", "~> 1.2" gem "kaminari-activerecord" -gem "paper_trail", "~> 15.1" +gem "paper_trail", "~> 16.0" gem "pg" gem "ransack", "~> 4.2.0" gem "scenic" diff --git a/Gemfile.lock b/Gemfile.lock index 91ef86be88a..d9687a2a567 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -620,7 +620,7 @@ GEM opentelemetry-semantic_conventions (1.10.1) opentelemetry-api (~> 1.0) os (1.1.4) - paper_trail (15.1.0) + paper_trail (16.0.0) activerecord (>= 6.1) request_store (~> 1.4) parallel (1.26.3) @@ -956,7 +956,7 @@ DEPENDENCIES opentelemetry-exporter-otlp opentelemetry-instrumentation-all opentelemetry-sdk - paper_trail (~> 15.1) + paper_trail (~> 16.0) parallel pg puma (~> 6.4)