Skip to content

Commit

Permalink
(fix) Add table name prefix override and ActiveRecord dependency for …
Browse files Browse the repository at this point in the history
…POA requests

- Override `table_name_prefix` to 'ar_' for models in the Accredited Representative Portal
- Add `activerecord` as a development dependency to fix spec issues

This ensures Power of Attorney request models in the engine use the correct table prefix
and that all specs pass successfully.
  • Loading branch information
ojbucao committed Dec 17, 2024
1 parent a827c28 commit 6024452
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ Gem::Specification.new do |spec|
spec.test_files = Dir['spec/**/*']

spec.add_dependency 'blind_index'
spec.add_development_dependency 'activerecord'
spec.add_development_dependency 'rspec-rails'
end
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
module AccreditedRepresentativePortal
class Engine < ::Rails::Engine
isolate_namespace AccreditedRepresentativePortal

# `isolate_namespace` redefines `table_name_prefix` on load of
# `active_record`, so we append our own callback to redefine it again how we
# want.
ActiveSupport.on_load(:active_record) do
AccreditedRepresentativePortal.redefine_singleton_method(:table_name_prefix) do
'ar_'
end
end

config.generators.api_only = true

# So that the app-wide migration command notices our engine's migrations.
Expand Down

0 comments on commit 6024452

Please sign in to comment.