diff options
Diffstat (limited to 'actiontext/lib/action_text/attribute.rb')
-rw-r--r-- | actiontext/lib/action_text/attribute.rb | 7 |
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 |