Skip to content

Commit

Permalink
upgrade to rails 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Jul 26, 2024
1 parent ceb2cc8 commit 82431af
Show file tree
Hide file tree
Showing 37 changed files with 201 additions and 195 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source 'https://rubygems.org'
ruby '3.3.3'

gem 'rails', '~> 7.1.3.4'
gem 'rails', github: 'rails/rails', branch: '7-2-stable'
gem 'pg', '~> 1.3.4'
gem 'puma', '~> 6.4.2'
gem 'bcrypt', '~> 3.1.7'
Expand Down Expand Up @@ -52,7 +52,7 @@ gem 'kaminari', '~> 1.2.0'
# Postgres/DB extensions
gem 'active_record_union'
gem 'active_record_distinct_on', '~> 1.6'
gem 'activerecord_where_assoc', '~> 1.1.4'
gem 'activerecord_where_assoc', '~> 1.1.5'
gem 'ar_lazy_preload', '~> 2.0'
gem 'strong_migrations'

Expand Down Expand Up @@ -111,7 +111,7 @@ group :development, :test do
gem 'byebug', platform: :mri
gem 'dotenv-rails'
gem 'timecop', '~> 0.9.5'
gem 'bullet', '~> 7.1.6'
# gem 'bullet', '~> 7.1.6'
gem 'parallel_tests', '~> 4.2.1'
gem 'cuke_modeler', '~> 3.19' # for running `parallel_test --group-by scenarios`
gem 'faker', '~> 2.20.0'
Expand Down
194 changes: 96 additions & 98 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,100 +1,123 @@
GIT
remote: https://github.com/stripe-ruby-mock/stripe-ruby-mock.git
revision: 6ceea9679bb573cb8bc6830f1bdf670b220a9859
ref: 6ceea9679bb573cb8bc6830f1bdf670b220a9859
remote: https://github.com/rails/rails.git
revision: 24dbf7637b1d5cd6eb3d7100b8d0f6872c3fee3c
branch: 7-2-stable
specs:
stripe-ruby-mock (3.1.0.rc3)
dante (>= 0.2.0)
multi_json (~> 1.0)
stripe (> 5, < 6)

GEM
remote: https://rubygems.org/
specs:
aasm (5.0.8)
concurrent-ruby (~> 1.0)
action_policy (0.6.3)
ruby-next-core (>= 0.14.0)
actioncable (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
actioncable (7.2.0.beta2)
actionpack (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
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.0.beta2)
actionpack (= 7.2.0.beta2)
activejob (= 7.2.0.beta2)
activerecord (= 7.2.0.beta2)
activestorage (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
mail (>= 2.8.0)
actionmailer (7.2.0.beta2)
actionpack (= 7.2.0.beta2)
actionview (= 7.2.0.beta2)
activejob (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
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.0.beta2)
actionview (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
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.0.beta2)
actionpack (= 7.2.0.beta2)
activerecord (= 7.2.0.beta2)
activestorage (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.3.4)
activesupport (= 7.1.3.4)
actionview (7.2.0.beta2)
activesupport (= 7.2.0.beta2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_record_distinct_on (1.6.0)
activerecord (>= 6.1, < 7.2)
active_record_union (1.3.0)
activerecord (>= 4.0)
activejob (7.1.3.4)
activesupport (= 7.1.3.4)
activejob (7.2.0.beta2)
activesupport (= 7.2.0.beta2)
globalid (>= 0.3.6)
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.0.beta2)
activesupport (= 7.2.0.beta2)
activerecord (7.2.0.beta2)
activemodel (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
timeout (>= 0.4.0)
activerecord_where_assoc (1.1.4)
activerecord (>= 4.1.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.0.beta2)
actionpack (= 7.2.0.beta2)
activejob (= 7.2.0.beta2)
activerecord (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
marcel (~> 1.0)
activesupport (7.1.3.4)
activesupport (7.2.0.beta2)
base64
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
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
tzinfo (~> 2.0, >= 2.0.5)
rails (7.2.0.beta2)
actioncable (= 7.2.0.beta2)
actionmailbox (= 7.2.0.beta2)
actionmailer (= 7.2.0.beta2)
actionpack (= 7.2.0.beta2)
actiontext (= 7.2.0.beta2)
actionview (= 7.2.0.beta2)
activejob (= 7.2.0.beta2)
activemodel (= 7.2.0.beta2)
activerecord (= 7.2.0.beta2)
activestorage (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
bundler (>= 1.15.0)
railties (= 7.2.0.beta2)
railties (7.2.0.beta2)
actionpack (= 7.2.0.beta2)
activesupport (= 7.2.0.beta2)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)

GIT
remote: https://github.com/stripe-ruby-mock/stripe-ruby-mock.git
revision: 6ceea9679bb573cb8bc6830f1bdf670b220a9859
ref: 6ceea9679bb573cb8bc6830f1bdf670b220a9859
specs:
stripe-ruby-mock (3.1.0.rc3)
dante (>= 0.2.0)
multi_json (~> 1.0)
stripe (> 5, < 6)

GEM
remote: https://rubygems.org/
specs:
aasm (5.0.8)
concurrent-ruby (~> 1.0)
action_policy (0.6.3)
ruby-next-core (>= 0.14.0)
active_record_distinct_on (1.6.0)
activerecord (>= 6.1, < 7.2)
active_record_union (1.3.0)
activerecord (>= 4.0)
activerecord_where_assoc (1.1.5)
activerecord (>= 4.1.0)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
anbt-sql-formatter (0.1.0)
Expand Down Expand Up @@ -122,9 +145,6 @@ GEM
bcrypt (3.1.17)
bigdecimal (3.1.8)
builder (3.2.4)
bullet (7.1.6)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (11.1.3)
capybara (3.36.0)
addressable
Expand Down Expand Up @@ -283,6 +303,7 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
lograge (0.12.0)
actionpack (>= 4)
activesupport (>= 4)
Expand Down Expand Up @@ -356,20 +377,6 @@ GEM
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)
bundler (>= 1.15.0)
railties (= 7.1.3.4)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
Expand All @@ -380,14 +387,6 @@ GEM
rails-pattern_matching (0.2.0)
activemodel
activerecord
railties (7.1.3.4)
actionpack (= 7.1.3.4)
activesupport (= 7.1.3.4)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
Expand Down Expand Up @@ -490,8 +489,8 @@ GEM
rails (>= 6.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uniform_notifier (1.16.0)
uri (0.12.2)
useragent (0.16.10)
webmock (3.14.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand All @@ -512,13 +511,12 @@ DEPENDENCIES
action_policy (~> 0.6.3)
active_record_distinct_on (~> 1.6)
active_record_union
activerecord_where_assoc (~> 1.1.4)
activerecord_where_assoc (~> 1.1.5)
anbt-sql-formatter
ar_lazy_preload (~> 2.0)
aws-sdk-s3 (~> 1)
barnes
bcrypt (~> 3.1.7)
bullet (~> 7.1.6)
byebug
cucumber-rails (~> 2.5)
cuke_modeler (~> 3.19)
Expand Down Expand Up @@ -552,7 +550,7 @@ DEPENDENCIES
rack-attack (~> 6.6)
rack-cors
rack-timeout
rails (~> 7.1.3.4)
rails!
rails-pattern_matching
redis (~> 4.7.1)
request_migrations (~> 1.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def show
attr_reader :package

def set_package
Current.resource = @package = FindByAliasService.call(
@package = Current.resource = FindByAliasService.call(
authorized_scope(current_account.release_packages.pypi),
id: params[:package],
aliases: :key,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def show
attr_reader :package

def set_package
Current.resource = @package = FindByAliasService.call(
@package = Current.resource = FindByAliasService.call(
authorized_scope(current_account.release_packages.tauri),
id: params[:package],
aliases: :key,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/release_engines_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show
def set_engine
scoped_engines = authorized_scope(current_account.release_engines)

Current.resource = @engine = FindByAliasService.call(
@engine = Current.resource = FindByAliasService.call(
scoped_engines,
id: params[:id],
aliases: :key,
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/release_packages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def destroy
def set_package
scoped_packages = authorized_scope(current_account.release_packages)

Current.resource = @package = FindByAliasService.call(
@package = Current.resource = FindByAliasService.call(
scoped_packages,
id: params[:id],
aliases: :key,
Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/accountable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def has_account(default: nil, **kwargs)

# Hook into both initialization and validation to ensure the current account
# is applied to new records (given no :account was provided).
#
# We're not using belongs_to(default:) because it only adds a before_validation
# callback, but we want to also do it after_initialize because new children
# may rely on the account being set on their parent.
after_initialize -> { self.account_id ||= Current.account&.id },
unless: -> { account_id_attribute_assigned? || account_attribute_assigned? },
if: -> { new_record? && account_id.nil? }
Expand Down
9 changes: 6 additions & 3 deletions app/models/concerns/environmental.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,18 @@ module Environmental
#
# Use :default to automatically configure a default environment for the model.
# Accepts a proc that resolves into an Environment or environment ID.
def has_environment(default: nil)
belongs_to :environment,
optional: true
def has_environment(default: nil, **kwargs)
belongs_to :environment, optional: true, **kwargs

tracks_attributes :environment_id,
:environment

# Hook into both initialization and validation to ensure the current environment
# is applied to new records (given no :environment was provided).
#
# We're not using belongs_to(default:) because it only adds a before_validation
# callback, but we want to also do it after_initialize because new children
# may rely on the environment being set on their parent.
after_initialize -> { self.environment_id ||= Current.environment&.id },
unless: -> { environment_id_attribute_assigned? || environment_attribute_assigned? },
if: -> { new_record? && environment.nil? }
Expand Down
3 changes: 3 additions & 0 deletions app/models/concerns/roleable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def define_roleable_association_and_delgate
accepts_nested_attributes_for :role, update_only: true
tracks_nested_attributes_for :role

validates :role,
presence: { message: 'must exist' }

delegate :permissions, :permission_ids, :role_permissions,
:role_permissions_attributes_assigned?, :role_permissions_attributes,
allow_nil: true,
Expand Down
6 changes: 6 additions & 0 deletions app/models/current.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ def account=(account)
self.token = nil
self.resource = nil
end

def account_id = account&.id
def environment_id = environment&.id
def bearer_id = bearer&.id
def token_id = token&.id
def resource_id = resource&.id
end
Loading

0 comments on commit 82431af

Please sign in to comment.