Skip to content

Commit

Permalink
Take AR affixes into account for Action Mailbox database models
Browse files Browse the repository at this point in the history
  • Loading branch information
chaadow committed Dec 8, 2023
1 parent 049c951 commit 6dde461
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions actionmailbox/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
* Fix all Action Mailbox database related models to respect
`ActiveRecord::Base.table_name_prefix` configuration.

*Chedli Bourguiba*

Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/actionmailbox/CHANGELOG.md) for previous changes.
2 changes: 0 additions & 2 deletions actionmailbox/app/models/action_mailbox/inbound_email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ module ActionMailbox
# inbound_email.mail.from # => 'david@loudthinking.com'
# inbound_email.source # Returns the full rfc822 source of the email as text
class InboundEmail < Record
self.table_name = "action_mailbox_inbound_emails"

include Incineratable, MessageId, Routable

has_one_attached :raw_email, service: ActionMailbox.storage_service
Expand Down
3 changes: 3 additions & 0 deletions actionmailbox/test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class Application < Rails::Application
# For compatibility with applications that use this config
config.action_controller.include_all_helpers = false

config.active_record.table_name_prefix = 'prefix_'
config.active_record.table_name_suffix = '_suffix'

# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
Expand Down
2 changes: 1 addition & 1 deletion actionmailbox/test/migrations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def rerun_migration
end

def action_mailbox_tables
[:action_mailbox_inbound_emails]
@action_mailbox_tables ||= ActionMailbox::Record.descendants.map { |klass| klass.table_name.to_sym }
end

def primary_key(table)
Expand Down

0 comments on commit 6dde461

Please sign in to comment.