[Ruby On Rails] How to use simple_format to display the entered text with line breaks

It is a memorandum.

When not using simple_format

ruby:show.html.erb


  <% @hoges.each do |hoge| %>
    <%= hoge.text %>
  <% end %>

When using simple_format

ruby:show.html.erb


  <% @hoges.each do |hoge| %>
    <%= simple_format(hoge.text) %>
  <% end %>

point

Write the target code you want to display in parentheses in the form of simple_format ().

Recommended Posts

[Ruby On Rails] How to use simple_format to display the entered text with line breaks
How to display the text entered in text_area in Rails with line breaks
How to use Ruby on Rails
[Ruby on Rails] How to use CarrierWave
[Ruby on Rails] How to use redirect_to
[Ruby on Rails] How to use kaminari
[Ruby on Rails] How to display error messages
[Ruby on Rails] How to use session method
[Ruby on Rails] How to change the column name
How to display a graph in Ruby on Rails (LazyHighChart)
[Ruby on Rails] "|| =" ← Summary of how to use this assignment operator
[Ruby on Rails] Use the resources method to automatically create routes.
[Rails] How to use rails console with docker
[Rails] How to use the map method
[Rails] How to use video_tag to display videos
How to make an application with ruby on rails (assuming that the environment has been built)
[Rails / simple_format] Helper method that reflects line breaks entered in the form
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to solve the local environment construction of Ruby on Rails (MAC)!
How to debug the processing in the Ruby on Rails model only on the console
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
[Ruby On Rails] How to search the contents of params using include?
How to add / remove Ruby on Rails columns
Publish the app made with ruby on rails
Determine the current page with Ruby on Rails
[Ruby on Rails] How to install Bootstrap in Rails
[Ruby basics] How to use the slice method
[Ruby on Rails] How to log in with only your name and password using the gem devise
How to resolve errors that occur in the "Ruby on Rails" integration test
[Ruby on Rails] Rails tutorial Chapter 14 Summary of how to implement the status feed
[Ruby on Rails] How to Japaneseize the error message of Form object (ActiveModel)
How to set the display time to Japan time in Rails
[Ruby on Rails] How to write enum in Japanese
How to make LINE messaging function made with Ruby
Rails / Ruby: How to get HTML text for Mail
[Rails] I don't know how to use the model ...
[Ruby On Rails] How to reset DB in Heroku
Solve the N + 1 problem with Ruby on Rails: acts-as-taggable-on
(Ruby on Rails6) How to create models and tables
[Rails] How to display an image in the view
Explanation of Ruby on rails for beginners ④ ~ Naming convention and how to use form_Tag ~
[Rails] How to use enum
How to use Ruby return
[Rails] How to use enum
How to use rails join
Ruby: How to use cookies
[Rails] How to use validation
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
[Rails] How to use Scope
[Ruby on Rails] Quickly display the page title in the browser
(Ruby on Rails6) Display of the database that got the id of the database
From Ruby on Rails error message display to Japanese localization
Uppercase only the specified range with substring. (How to use substring)
[With back tricks] How to introduce React to the simplest Rails
[Note] About the Fizz_Buzz problem (How Ruby on Rails works)
Line breaks in the entered text are not displayed in view
[Rails] How to display the list of posts by category
How to run React and Rails on the same server
[Rails] How to display information stored in the database in view
[Ruby On Rails] How to search and save the data of the parent table from the child table