mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
76b33aa3d1
Permit generating rich-text attachment markup in YAML fixtures: hello_world_review_content: record: hello_world (Review) name: content body: <p><%= ActionText::FixtureSet.attachment("messages", :hello_world) %> is great!</p>
12 lines
413 B
Ruby
12 lines
413 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ActionText
|
|
class FixtureSet
|
|
def self.attachment(fixture_set_name, label, column_type: :integer)
|
|
signed_global_id = ActiveRecord::FixtureSet.signed_global_id fixture_set_name, label,
|
|
column_type: column_type, for: ActionText::Attachable::LOCATOR_NAME
|
|
|
|
%(<action-text-attachment sgid="#{signed_global_id}"></action-text-attachment>)
|
|
end
|
|
end
|
|
end
|