Missing host to link to!

So I was outputting URL from a rails model with


but my specs were complaining with

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

after some googling and trial and errors I found that this line would did the trick. Put it in your test_helper or spec_helper

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

cheers :D


One thought on “Missing host to link to!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s