[RUBY] Convert the array of errors.full_messages to characters and output

Problems that have occurred and what you want to do

Since errors.full_messages is an array, the flash message is output as ["hoge hoge"] → I want to change it to characters and output hogehoge

What i did

Just add the to_sentence method to errors.full_messages

user_contorller.rb


class Users::UserController < Users::ApplicationController
#Omission

def update
 @user = user.Users
flash[:alert] = @user.errors.full_messages.to_sentence
 end

#Omission
end

Thank you for your hard work today.

Recommended Posts

Convert the array of errors.full_messages to characters and output
[Swift5] How to get an array and the complement of arrays
Convert an array of strings to numbers
Output of the book "Introduction to Java"
How to convert an array of Strings to an array of objects with the Stream API
I want to output the day of the week
Output of how to use the slice method
Output the sum of each name and its contents from a multiple array
Gzip-compress byte array in Java and output to file
I want to convert characters ...
[Java] Convert ArrayList to array
[Note] Java Output of the sum of odd and even elements
Command to check the number and status of Java threads
I want to change the log output settings of UtilLoggingJdbcLogger
The nth and n + 1st characters of a Ruby string
Java beginners briefly summarized the behavior of Array and ArrayList
Change the file name and output destination of the JavaVM error file
How to add elements without specifying the length of the array
How to check the extension and size of uploaded files
Convert alphabet to 26 base + array length
Try to imitate the idea of a two-dimensional array with a one-dimensional array
[Rails] How to get the URL of the transition source and redirect
How to set the IP address and host name of CentOS8
Convert line feed code to html line feed tag with Thymeleaf and output
How to output the value when there is an array in the array
This and that of the JDK
The story of toString () starting with passing an array to System.out.println
How to convert LocalDate and Timestamp
Method to add the number of years and get the end of the month
Read the first 4 bytes of the Java class file and output CAFEBABE
[Rails] Read the RSS of the site and return the contents to the front
From fledgling Java (3 years) to Node.js (4 years). And the impression of returning to Java
I tried to summarize the methods of Java String and StringBuilder
[Java] How to convert from String to Path type and get the path
I made a tool to output the difference of CSV file
[Java] Convert array to ArrayList * Caution
Convert Swift 2D array to C 2D array
[Java] Output the result of ffprobe -show_streams in JSON and map it to an object with Jackson
[Ruby] I want to output only the odd-numbered characters in the character string
How to output the sum of any three numbers, excluding the same value
The story of forgetting to close a file in Java and failing
I tried to summarize the key points of gRPC design and development
Add the date to the GC statistics acquired by gcutil and output it.
[Ruby] I want to extract only the value of the hash and only the key
Confirmation and refactoring of the flow from request to controller in [httpclient]
Don't forget to summarize the features and points of the flea market apps
Get the type of an array element to determine if it is an array
How to change the maximum and maximum number of POST data in Spark
I want to pass the argument of Annotation and the argument of the calling method to aspect
[Java improvement case] How to reach the limit of self-study and beyond
I translated the grammar of R and Java [Updated from time to time]
[Rails] Articles for beginners to organize and understand the flow of form_with
I tried to measure and compare the speed of GraalVM with JMH
Output HTTP header of google-http-client to log
Folding and unfolding the contents of the Recyclerview
About the operation of next () and nextLine ()
[Java] How to output and write files!
Compare the elements of an array (Java)
How to determine the number of parallels
How to sort the List of SelectItem
How to find the tens and ones