Skip to content

Commit

Permalink
Extract ActionText::Record
Browse files Browse the repository at this point in the history
Permit applications to hack in custom DB config for ActionText::RichText until AT has first-class multi-DB support:

    ActiveSupport.on_load(:action_text_record) do
      connects_to reading: :action_text_replica, writing: :action_text_primary
    end
  • Loading branch information
georgeclaghorn committed Sep 29, 2020
1 parent a50d2f1 commit b0287d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions actiontext/app/models/action_text/record.rb
@@ -0,0 +1,9 @@
# frozen_string_literal: true

module ActionText
class Record < ActiveRecord::Base #:nodoc:
self.abstract_class = true
end
end

ActiveSupport.run_load_hooks :action_text_record, ActionText::Record
2 changes: 1 addition & 1 deletion actiontext/app/models/action_text/rich_text.rb
Expand Up @@ -5,7 +5,7 @@ module ActionText
# It also holds all the references to the embedded files, which are stored using Active Storage.
# This record is then associated with the Active Record model the application desires to have
# rich text content using the +has_rich_text+ class method.
class RichText < ActiveRecord::Base
class RichText < Record
self.table_name = "action_text_rich_texts"

serialize :body, ActionText::Content
Expand Down

0 comments on commit b0287d0

Please sign in to comment.