Be in trouble

I tried to give a class attribute with simple_format according to the Rails docs,
It does not apply when viewed in the developer tools. ..
Reference URL:Rails documentation: simple_format

The purpose is to apply CSS to the part surrounded by simple_format,
I want to specify a class for that.

Current status
  • code
<% = simple_format (h (@ post.description), {}, sanitize: false, wrapper_tag: "div", class:'post-description')%>
  • Target location in the browser (Chrome developer tools)

In codeclass:'post-description'Despite specifying
class does not apply.
If i add a class in a place other than this simple_format,
Since it is applied to the browser as added, I think that the development environment itself is not a problem.

What I tried
  • wrapper_tag: Delete "div".
    ⇒ I tried to modify it below, but the situation did not change.
<% = simple_format (h (@ post.description), {}, sanitize: false, class:'post-description')%>

The purpose of using this simple_format is
I want to display the multi-line text entered in the text area on the input form.
It is used so that the line breaks entered by the user are reflected.

I don't think it's necessary to stick to using simple_format as long as the class name is given while satisfying that purpose.
(I'm wondering if it doesn't follow the Rails documentation, but ...)


Rails 5.2.4
Ruby 2.6.5

We would appreciate it if you could point out any missing information.
We apologize for the inconvenience, and thanks for your cooperation.

  • Answer # 1

    <% = simple_format ("a", {class:'post-description'}, {sanitize: false, wrapper_tag: "div"})%>

    If so


    have become.