diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2018-06-07 14:38:57 +0200 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2018-06-07 14:38:57 +0200 |
commit | 83d781ed01459cb80d10a1c8e91e3d6f36c01913 (patch) | |
tree | bb186321ef84d5a8f06b411e78e0d737ffce6c64 | |
parent | d5623dc634dc6e8ce8294485e1fdb6adb5f16271 (diff) | |
download | rails-83d781ed01459cb80d10a1c8e91e3d6f36c01913.tar.gz rails-83d781ed01459cb80d10a1c8e91e3d6f36c01913.tar.bz2 rails-83d781ed01459cb80d10a1c8e91e3d6f36c01913.zip |
Add scope to preload embeds as well
-rw-r--r-- | lib/action_text/attribute.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/action_text/attribute.rb b/lib/action_text/attribute.rb index 30cbab70db..6ed72fd852 100644 --- a/lib/action_text/attribute.rb +++ b/lib/action_text/attribute.rb @@ -17,6 +17,7 @@ module ActionText has_one :"rich_text_#{name}", -> { where(name: name) }, class_name: "ActionText::RichText", as: :record, inverse_of: :record, 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 { public_send(name).save if public_send(name).changed? } end |