I have a view for ActionMailer that includes several different links. I am running it on localhost: 3000 right now, so I installed this as such in a file called setup_mail.rb in app / initializers (as indicated here ):
ActionMailer::Base.default_url_options[:host] = "localhost:3000"
When I switch to using url_for in a view, this does not seem to pull this value. If I add :host => "localhost:3000" to each url_for tag, they work correctly. But they do not work without it.
I have another project_url tag that looks like this: a link to the specified project. This function, including the host value, has only project_url(@project) . Why work, not another?
From all that I read, setting default_url_options[:host] in the initializer should allow me to omit the value :host in the url_for tag. Obviously, itβs not the worst thing in the world to simply add this value, but it seems unnecessary, and that means that when I end up taking the project somewhere, I will have to go through and change this value everywhere. But worse, this is something that I do not understand. I am still involved when I go here, so I would like to know what I am doing wrong.
source share