Missing Host to Link To! Please Provide the :Host Parameter, for Rails 4

Missing host to link to! Please provide the :host parameter, for Rails 4

For Rails 5, use:

Rails.application.routes.default_url_options[:host] = "XXX"

You can put this in a config/environments/ file (or any other initializer), or e.g. at the beginning of config/routes.rb.

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


Your::Application.routes.draw do
default_url_options :host => "example.com"

# ... snip ...
end

Somewhere in routes.rb :)

Missing host to link to! Please provide the :host parameter, set default_url_options[:host]

If you are using Rails 5, try this:

Rails.application.routes.default_url_options[:host] = "XXX"

Found this post about Rails 4 and there was a similar discussion in the Rails repository on Github

Heroku/devise - Missing host to link to! Please provide :host parameter or set default_url_options[:host]

You need to add this to your environment.rb

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

Make sure you change host to your production url and keep it localhost for development. This is for the mailer, it needs a default email to send out notices such as confirmations etc...


You should check the logs on the heroku server heroku logs run that from the console and it will tell you the exact error.

When you push to heroku you need to configure the environment.rb file with the heroku subdomain:

config.action_mailer.default_url_options = { :host => 'yourapp.heroku.com' }

Depending upon version, this should go in production.rb, not environment.rb.

How do I resolve Missing host to link to! Please provide the :host parameter ? (RoR)

In the end I just used:

root_path

instead of:

root_url

ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true


Spree::Auth::Config[:confirmable] = false

This line of code from prescription_photos_rest.rb was overwritten buy a env value.

ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

In the end I added the following with the correct value to each environment file:

test.rb / development.rb / production.rb

Devise 3.2.x - 4.x.x

Rails 4.1.x && Rails 4.2.x && Rails 5.x.x

Thanks to maudulus

# Default Mailer Host
Rails.application.routes.default_url_options[:host] = 'domain.example'

Missing host to link to! Please provide :host parameter or set default_url_options[:host] (ActionView::Template::Error)

Cucumber runs your test environment so you need to add the very same line in test.rb.



Related Topics



Leave a reply



Submit