I don't see the flash message with redirect_to

Event

Even if I write as below, the flash message is not displayed and msg is included in the query parameter.

redirect_to action: :new, alert: 'msg'

solution

Describe as follows.

redirect_to({:action => :new} , {:alert => 'msg'})

Cause

Use redirect_to as follows.

redirect_to(options = {}, response_options = {})

If you write it like the beginning, the flash message will also be treated as the first argument.

redirect_to action: :new, alert: 'msg'
↓
redirect_to({:action => :new, :alert => 'msg'}, { })

Recommended Posts

I don't see the flash message with redirect_to
I got a warning message with the rails _6.0.3_ new hello_myapp command
I don't see an error in Rails bundle install ... the solution
[NCMB] I searched the data store with mbaas
I checked the number of taxis with Ruby
Rails Flash Message
[Rails] I tried playing with the comment send button
[Rails] I don't know how to use the model ...
I want to dark mode with the SWT app
I investigated the super that I met with the devise controller
[Rails] I investigated the difference between redirect_to and render.
What to do if you don't see the test code error message in the terminal console