I was addicted to setting default_url_options with Rails devise introduction

devise user authentication settings

In the case of default, it is often set as {host:'localhost', port: 3000} in config.action_mailer.default_url_options as shown below.

development.rb


  # default url
  config.action_mailer.default_url_options = {  host: 'localhost', port: 3000 }
  # mail setting
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => 587,
    :user_name => Rails.application.credentials.gmail[:user_name],
    :password => Rails.application.credentials.gmail[:password],
    :authentication => :plain,
    :enable_starttls_auto => true
  }

In that case, the URL sent in the verification email is http: // localhost: 3000 / users / confirmation? Confirmation_token = -XiHyA_1xCxhk846ae9G I think it will be shaped like this.

Since the root directory was built with Docker without the 3000 port, I had to create the URL without the port number, so I changed the settings as follows.

development.rb


config.action_mailer.default_url_options = {  host: 'localhost' }

URL does not change

Originally, the URL should not be generated in the form of http: // localhost / users / confirmation? Confirmation_token = -XiHyA_1xCxhk846ae9G, and I was addicted to it for several hours.

Conclusion

It was reflected by restarting Docker.

There is always a point that I am addicted to when developing the Web, but since it often works by restarting, I would like to keep more in mind to "try restarting if I get addicted".

Recommended Posts

I was addicted to setting default_url_options with Rails devise introduction
What I was addicted to when implementing google authentication with rails
I was addicted to doing onActivityResult () with DialogFragment
I want to authenticate users to Rails with Devise + OmniAuth
I was addicted to starting sbt
What I was addicted to while using rspec on rails
A story I was addicted to in Rails validation settings
I was addicted to the setting of laradock + VSCode + xdebug
What I was addicted to with the Redmine REST API
What I was addicted to when trying to properly openAPI/Swagger documentation with Rails + Grape + Grape Swagger
The story I was addicted to when setting up STS
I was addicted to the API version min23 setting of registerTorchCallback
I was addicted to rewriting to @SpringApplicationConfiguration-> @SpringBootTest
I was addicted to the roll method
I was addicted to the Spring-Batch test
[Rails] I was addicted to the nginx settings when using Action Cable.
Problems I was addicted to when building the digdag environment with docker
I was a little addicted to running old Ruby environment and old Rails
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
I was addicted to unit testing with the buffer operator in RxJava
I was addicted to using RXTX on Sierra
A story that I was addicted to twice with the automatic startup setting of Tomcat 8 on CentOS 8
I was addicted to installing Ruby/Tk on MacOS
I want to play with Firestore from Rails
[Rails] I want to load CSS with webpacker
SpringSecurity I was addicted to trying to log in with a hashed password (solved)
[Rails] I want to test with RSpec. We support your step [Introduction procedure]
Handle devise with Rails
[Rails] devise introduction method
I was addicted to the NoSuchMethodError in Cloud Endpoints
I was addicted to the record of the associated model
[Rails] Initial setting of user-created login with devise, devise_token_auth
Addicted to the webpacker that comes standard with Rails 6
What I was addicted to when developing a Spring Boot application with VS Code
A memo that I was addicted to when making batch processing with Spring Boot
The part I was addicted to in "Introduction to Ajax in Java Web Applications" of NetBeans
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
I tried to make an introduction to PHP + MySQL with Docker
[Rails] Introduction of devise Basics
What I was addicted to when introducing the JNI library
What I fixed when updating to Spring Boot 1.5.12 ・ What I was addicted to
[Rails] I tried to create a mini app with FullCalendar
I want to push an app made with Rails 6 to GitHub
[Rails] How to install devise
I was addicted to looping the Update statement on MyBatis
A story I was addicted to before building a Ruby and Rails environment using Ubuntu (20.04.1 LTS)
[Rails] I tried to implement batch processing with Rake task
[Rails] Add column to devise
I want to manually send an authorization email with Devise
I was addicted to using Java's Stream API in Scala
A story I was addicted to with implicit type conversion of ActiveRecord during unit testing
I was addicted to WSl when trying to build an android application development environment with Vue.js
Introduction to RSpec-Everyday Rails Summary-
Technical causes and countermeasures for the points I was addicted to with the first Android app & Kotlin
[Rails] How to solve ActiveSupport :: MessageVerifier :: InvalidSignature that I was addicted to when introducing twitter login [ActiveStorage]
[Circle CI] A story I was addicted to at Start Building
I want to convert an array to Active Record Relation with Rails
I want to add a browsing function with ruby on rails
I tried to implement the image preview function with Rails / jQuery
A note when I was addicted to converting Ubuntu on WSL1 to WSL2
About the matter that I was addicted to how to use hashmap