aboutsummaryrefslogtreecommitdiffstats
path: root/actiontext/lib
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2019-03-17 17:22:46 -0400
committerGitHub <noreply@github.com>2019-03-17 17:22:46 -0400
commitc399f7d07a88d333fa05a361c66a252d9fa462bb (patch)
tree5ee1abed22acc291021bf9ef8e591223f6369510 /actiontext/lib
parent7971fc4b49979a8d1ded09e311c5c09a09af5b93 (diff)
downloadrails-c399f7d07a88d333fa05a361c66a252d9fa462bb.tar.gz
rails-c399f7d07a88d333fa05a361c66a252d9fa462bb.tar.bz2
rails-c399f7d07a88d333fa05a361c66a252d9fa462bb.zip
Fix updating rich text via nested attributes
Closes #35159.
Diffstat (limited to 'actiontext/lib')
-rw-r--r--actiontext/lib/action_text/attribute.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/actiontext/lib/action_text/attribute.rb b/actiontext/lib/action_text/attribute.rb
index f226dd21bd..f9a604096c 100644
--- a/actiontext/lib/action_text/attribute.rb
+++ b/actiontext/lib/action_text/attribute.rb
@@ -34,14 +34,11 @@ module ActionText
end
CODE
- has_one :"rich_text_#{name}", -> { where(name: name) }, class_name: "ActionText::RichText", as: :record, inverse_of: :record, dependent: :destroy
+ has_one :"rich_text_#{name}", -> { where(name: name) },
+ class_name: "ActionText::RichText", as: :record, inverse_of: :record, autosave: true, dependent: :destroy
scope :"with_rich_text_#{name}", -> { includes("rich_text_#{name}") }
scope :"with_rich_text_#{name}_and_embeds", -> { includes("rich_text_#{name}": { embeds_attachments: :blob }) }
-
- after_save do
- public_send(name).save if public_send(name).changed?
- end
end
end
end