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

前端 未结 15 2695
深忆病人
深忆病人 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:31

    Rails.application.routes.default_url_options[:host]= 'localhost:3000'

    In the developemnt.rb / test.rb, can be more concise as following:

    Rails.application.configure do
      # ... other config ...
    
      routes.default_url_options[:host] = 'localhost:3000'
    end
    

提交回复
热议问题