Ruby on rails Rails邮件程序无法在主机上接收

Ruby on rails Rails邮件程序无法在主机上接收,ruby-on-rails,ruby,ruby-on-rails-4,Ruby On Rails,Ruby,Ruby On Rails 4,站点位于子目录/app 在development.rb中: config.action_mailer.default_url_options = { host: 'localhost:3000/app' } 邮件项中生成的Url\u Url(1): localhost/item/1,它应该是:localhost:3000/app/item/1 如何将localhost替换为localhost:3000/app 这在Rails 4.1.15中。来扩展tadman的评论。。。您的主机应该只有“

站点位于子目录
/app

在development.rb中:

config.action_mailer.default_url_options = {
  host: 'localhost:3000/app'
}
邮件
项中生成的Url\u Url(1)

localhost/item/1
,它应该是:
localhost:3000/app/item/1

如何将
localhost
替换为
localhost:3000/app


这在Rails 4.1.15中。

来扩展tadman的评论。。。您的主机应该只有“localhost”部分和单独的端口选项:

config.action_mailer.default_url_options = {
  host: 'localhost',
  port: 3000
}
关于在/app下加载应用程序:

config.relative_url_root = "/app"

(详情请参见)

要进一步了解塔德曼的评论。。。您的主机应该只有“localhost”部分和单独的端口选项:

config.action_mailer.default_url_options = {
  host: 'localhost',
  port: 3000
}
关于在/app下加载应用程序:

config.relative_url_root = "/app"

(详情请参见)

使用
script\u name
实现了以下目的:

config.action_mailer.default_url_options = { 
  host: 'localhost', 
  port: 3000, 
  script_name: '/app' 
}

使用
script\u name
实现了以下目的:

config.action_mailer.default_url_options = { 
  host: 'localhost', 
  port: 3000, 
  script_name: '/app' 
}

/app
不是有效的主机名组件。
/app
不是有效的主机名组件。
主机:
中可能应该省略该端口,因为它在
端口:
中有描述。主机和端口工作<代码>相对url\u根目录没有。越来越近从
主机:
中可能应该忽略该端口,因为它在
端口:
中有描述。主机和端口工作<代码>相对url\u根目录没有。越来越近