Create ASt::Attachment records for ASt::Blobs in content
This commit is contained in:
parent
6408111e71
commit
9ded0f3c42
|
@ -5,6 +5,13 @@ module ActiveText
|
|||
class_methods do
|
||||
def active_text_attribute(attribute_name)
|
||||
serialize(attribute_name, ActiveText::Content)
|
||||
|
||||
has_many_attached "#{attribute_name}_attachments"
|
||||
|
||||
after_save do
|
||||
blobs = public_send(attribute_name).attachments.map(&:attachable)
|
||||
public_send("#{attribute_name}_attachments_blobs=", blobs)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue