Skip to content

Commit

Permalink
Take AR affixes into account for Action Text 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 52dde00
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions actiontext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* Fix all Action Text database related models to respect
`ActiveRecord::Base.table_name_prefix` configuration.

*Chedli Bourguiba*

* Compile ESM package that can be used directly in the browser as actiontext.esm.js

*Matias Grunberg*
Expand Down
2 changes: 0 additions & 2 deletions actiontext/app/models/action_text/encrypted_rich_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

module ActionText
class EncryptedRichText < RichText
self.table_name = "action_text_rich_texts"

encrypts :body
end
end
Expand Down
2 changes: 0 additions & 2 deletions actiontext/app/models/action_text/rich_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ module ActionText
# message.content.to_s # => "<div>safeunsafe</div>"
# message.content.to_plain_text # => "safeunsafe"
class RichText < Record
self.table_name = "action_text_rich_texts"

##
# :method: to_s
#
Expand Down
4 changes: 1 addition & 3 deletions actiontext/test/dummy/app/models/encrypted_message.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
class EncryptedMessage < ApplicationRecord
self.table_name = "messages"

class EncryptedMessage < Message
has_rich_text :content, encrypted: true
end
3 changes: 3 additions & 0 deletions actiontext/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

0 comments on commit 52dde00

Please sign in to comment.