Missing host to link to! Please provide the :host parameter, for Rails 4
<blockquote>
  <p>Missing host to link to! Please provide the :host parameter, set
  default_url_options[:host], or set :only_path to true</p>
</blockquote>

<p>I randomly get this error at time, generally restarting the server fixes the issue for a while, and then it shows up again.
I have added 
<code>config.action_mailer.default_url_options = "localhost:3000"</code>, in the development and test.rb files.</p>

<p>Also, I have used <code>include Rails.application.routes.url_helpers</code>
in one module to get access to the routes, I read this could be the reason I get these errors but removing it will leave me with no access to the routes.<br>
The module is for the datatables gem.</p>