aboutsummaryrefslogtreecommitdiffstats
path: root/actiontext/lib/action_text
diff options
context:
space:
mode:
Diffstat (limited to 'actiontext/lib/action_text')
-rw-r--r--actiontext/lib/action_text/attachable.rb4
-rw-r--r--actiontext/lib/action_text/attribute.rb9
-rw-r--r--actiontext/lib/action_text/gem_version.rb4
3 files changed, 9 insertions, 8 deletions
diff --git a/actiontext/lib/action_text/attachable.rb b/actiontext/lib/action_text/attachable.rb
index 38cd24aa8d..3343bcc308 100644
--- a/actiontext/lib/action_text/attachable.rb
+++ b/actiontext/lib/action_text/attachable.rb
@@ -67,6 +67,10 @@ module ActionText
super.merge(attachable_sgid: attachable_sgid)
end
+ def to_trix_content_attachment_partial_path
+ to_partial_path
+ end
+
def to_rich_text_attributes(attributes = {})
attributes.dup.tap do |attrs|
attrs[:sgid] = attachable_sgid
diff --git a/actiontext/lib/action_text/attribute.rb b/actiontext/lib/action_text/attribute.rb
index f226dd21bd..ddc6822a4c 100644
--- a/actiontext/lib/action_text/attribute.rb
+++ b/actiontext/lib/action_text/attribute.rb
@@ -26,7 +26,7 @@ module ActionText
def has_rich_text(name)
class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}
- self.rich_text_#{name} ||= ActionText::RichText.new(name: "#{name}", record: self)
+ rich_text_#{name} || build_rich_text_#{name}
end
def #{name}=(body)
@@ -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
diff --git a/actiontext/lib/action_text/gem_version.rb b/actiontext/lib/action_text/gem_version.rb
index 5404ac54e9..8b4103712c 100644
--- a/actiontext/lib/action_text/gem_version.rb
+++ b/actiontext/lib/action_text/gem_version.rb
@@ -8,9 +8,9 @@ module ActionText
module VERSION
MAJOR = 6
- MINOR = 0
+ MINOR = 1
TINY = 0
- PRE = "beta1"
+ PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end