1

If I trying access to routes helpers via Rails.application.routes.url_helpers everything ok, while I'm using *_path routes (article_path, note_path, etc.). But I need use *_url routes(articles_url, note_url, etc.). In this case I'm getting missing host error.

Rails version is 3.2.12

Meliborn
  • 6,495
  • 6
  • 34
  • 53
  • see this [answer](http://stackoverflow.com/questions/2660172/how-do-i-set-default-host-for-url-helpers-in-rails) – tihom Sep 20 '13 at 18:19
  • Are there any better solutions? I have 4 environments and sets all of they in application controller it's not a good idea. They are sets in ```/config/environments/*``` files too. – Meliborn Sep 20 '13 at 18:27
  • 2
    I use a global variable like `HOST` and set it in `environment.rb` for each environment. Then in controller I can do `def default_url_options :host => HOST end` – tihom Sep 20 '13 at 18:30

0 Answers0