mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
8cc8fe9628
Prior to this commit, `ActionText::Content#inspect` called `#to_s` and truncated the result to 25 characters. However, `#to_s` calls `#to_rendered_html_with_layout` which, by default, renders the same first 25 characters for every instance. For example, with models such as: ```ruby class Message < ActiveRecord::Base has_rich_text :content end Message.create(content: "first message") Message.create(content: "second message") Message.create(content: "third message") ``` The output of `#inspect` is indistinguishable: ```irb irb> Message.all.map { |message| message.content.body } Rendered .../actiontext/app/views/action_text/contents/_content.html.erb within layouts/action_text/contents/_content (Duration: 2.4ms | Allocations: 881) Rendered .../actiontext/app/views/action_text/contents/_content.html.erb within layouts/action_text/contents/_content (Duration: 0.7ms | Allocations: 257) Rendered .../actiontext/app/views/action_text/contents/_content.html.erb within layouts/action_text/contents/_content (Duration: 0.6ms | Allocations: 257) => [#<ActionText::Content "<div class=\"trix-conte...">, #<ActionText::Content "<div class=\"trix-conte...">, #<ActionText::Content "<div class=\"trix-conte...">] ``` This commit changes `#inspect` to call `#to_html`, which does not render the Action Text layout. So the output of `#inspect` will be: ```irb irb> Message.all.map { |message| message.content.body } => [#<ActionText::Content "first message">, #<ActionText::Content "second message">, #<ActionText::Content "third message">] ``` |
||
---|---|---|
.. | ||
attachables | ||
attachments | ||
attachable.rb | ||
attachment.rb | ||
attachment_gallery.rb | ||
attribute.rb | ||
content.rb | ||
encryption.rb | ||
engine.rb | ||
fixture_set.rb | ||
fragment.rb | ||
gem_version.rb | ||
html_conversion.rb | ||
plain_text_conversion.rb | ||
rendering.rb | ||
serialization.rb | ||
system_test_helper.rb | ||
trix_attachment.rb | ||
version.rb |