Using the code generated by restful_authentication, we usually get 'localhost' as the URL in the sign up and activation mails. I am trying to create something like this instead:
def signup_notification(user, host)
setup_email(user)
@subject += 'Please activate your new account'
@body[:url] = "http://#{host}/activate/#{user.activation_code}"
end
However, since the actual call to deliver the mail is in an Observer, I can't do this:
UserMailer.deliver_signup_notification(user, request.host_with_port)
Since the request method is not available in models. What is the best way to go about doing this?
I thought about storing URLs per domain in a YAML file and then loading it on startup but then the ports may change, so it wouldn't work.
Alternatively, I thought about creating a static class variable somewhere that is set upon loading up the application, but I don't know how to go about doing this. Is the request method available for initializers?