我想在heroku上推送我的应用程序.我还在开发中.我使用了可确认模块的设计.
当我尝试使用heroku控制台添加用户时出现此错误:
Missing host to link to! Please provide :host parameter or set default_url_options[:host]
Run Code Online (Sandbox Code Playgroud)
在测试和开发环境中,我有以下行:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
Run Code Online (Sandbox Code Playgroud)
我没有在生产环境中设置一些东西.
我试过推
config.action_mailer.default_url_options = { :host => 'mywebsitename.com' }
config.action_mailer.default_url_options = { :host => 'heroku.mywebsitename.com' }
Run Code Online (Sandbox Code Playgroud)
但它也不起作用..
我在网上看到它可能与ActionMailer有关,但我不知道我要配置什么.非常感谢你的想法!
嗨,
为了在我推动heroku时不让我的应用程序崩溃,我把它放在我的env/test.rb和我的env/dev.rb(不在env.rb中,我认为这是因为它是rails 3应用程序)
config.action_mailer.default_url_options = { :host => 'yourapp.heroku.com' }
Run Code Online (Sandbox Code Playgroud)
但是当我尝试在heroku控制台中创建用户时:
User.create(:username => "test", :email => "test@test.com", :password => "test1234", :password_confirmation => "test1234", :confirmed_at => "2010-11-03 14:11:15.520128")
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
ActionView::Template::Error: Missing host to link to! Please provide :host parameter …Run Code Online (Sandbox Code Playgroud) 我现在谷歌搜索大约90分钟仍然没有得到答案.我在哪里设置default_url_options?我已经将其设置为config.action_mailer.default_url_options在其他地方解决此相同的错误,但现在我在尝试在RSpec规范中使用URL帮助程序时遇到此错误.我不知道它在哪里设置default_url_options.
Failure/Error: listing_url(listing).should match(/\/\d+-\w+$/)
RuntimeError:
Missing host to link to! Please provide :host parameter or set default_url_options[:host]
# ./spec/routing/listing_routing_spec.rb:9:in `block (3 levels) in <top (required)>'
Run Code Online (Sandbox Code Playgroud)
这段代码与emails/ActionMailer无关,它恰好需要一个URL而不是一个路径.
有任何想法吗?