Rails: Missing host to link to! Please provide :host parameter or set default_url_options[:host]

前端 未结 15 2689
深忆病人
深忆病人 2020-11-27 10:34

I have been googling for about 90 minutes now and still don\'t have an answer to this. Where do I set default_url_options? I\'ve already set it for conf

15条回答
  •  情书的邮戳
    2020-11-27 11:33

    Adding the default_url in routes not the right solution although, it works for some cases.

    You've to set the default_url in each environment(development, test, production).

    You need make these changes.

        config/environments/development.rb
         config.action_mailer.default_url_options = 
          { :host => 'your-host-name' }  #if it is local then 'localhost:3000'
    
     config/environments/test.rb
          config.action_mailer.default_url_options = 
          { :host => 'your-host-name' }  #if it is local then 'localhost:3000'
    
      config/environments/development.rb
         config.action_mailer.default_url_options = 
          { :host => 'your-host-name' }  #if it is local then 'localhost:3000'
    

提交回复
热议问题