ruby - [rails] the class attribute specified by the div tag enclosed in simple_format is not applied
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.
- code
show.html.erb
<% = 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.
- 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
Related articles
- ruby on rails - i want to add a class to link_to
- ruby on rails - how to test that a specific element has a class name using rspec/capybara
- ruby on rails - even though i can log in with rails, the current_user specified in the user details view becomes nil and an erro
- ruby - [rails] i want to create a link including the data attribute with the link_to helper
- ruby on rails - about passing the attribute of ror class as an argument
- ruby - the last db setting doesn't work when deploying rails app on aws
- ruby on rails - [rails] the initial image of the icon for the user is not displayed
- ruby on rails - i want to write a rails tutorial test in rspec
- ruby on rails - how to debug with rails pry in docker environment
- ruby - i want to output csv with narrowed down conditions with rails
- ruby on rails - error when implementing rails6 follow function
- ruby on rails - i get an error without being created
- ruby on rails - the value of find_by (id :) becomes nil
- ruby - unable to save comments in db (rails)
- ruby - rails: fattachment_field gives undefined method error
- ruby on rails 5 - the path is changed by redirect_to of rails
- ruby on rails - description of rails packagejson
- ruby on rails - i want to change from the state where only one posted image is displayed to the state where two posted images ar
- ruby on rails 6 - when i press new user registration, i get an error of no route matches [get] "/ users"
- ruby - sass :: syntaxerror on rails s
- javascript - i want the scroll bar to always appear at the bottom of the chat screen
- ruby - i want to use two rails renders
- ruby - the top screen is displayed at http: // localhost: 3000/users/sign_in
- ruby on rails removal function
- ruby on rails sorting
- html - i can't set the regular expression well
- ruby - rails i want to make the created_at time the same when creating multiple data at once
- ruby - dynamic form implementation in nested_form
If so
have become.
simple_format