Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>EDIT: I've found a much easier way: <a href="http://www.arctickiwi.com/blog/7-host-and-domain-based-routing-in-ruby-on-rails" rel="nofollow noreferrer">http://www.arctickiwi.com/blog/7-host-and-domain-based-routing-in-ruby-on-rails</a></p> <p>Not exactly an answer but this is the best I can give. Maybe this'll help you too.</p> <p>Ideally, <a href="http://transfs.com/devblog/2009/01/21/hosting-multiple-domains-from-a-single-rails-app/" rel="nofollow noreferrer">this blog post from transfs.com</a> and subdomain-fu should do the trick. I've been trying to implement it, however, and they don't seem to play nicely together.</p> <p>Basically, if I don't include the intiializer, the subdomain route works fine. If I include the initializer, the subdomain route breaks (everything gets caught by map.root). I have a feeling it's with the way it builds the condition string in the initializer. If you can figure out how it breaks, then you'll have a working app.</p> <p>My initializer:</p> <p><code><pre> module ActionController module Routing class RouteSet def extract_request_environment(request) env = { :method => request.method } env[:domain] = request.domain if request.domain env[:host] = request.host if request.host<br> env end end class Route alias_method :old_recognition_conditions, :recognition_conditions def recognition_conditions result = old_recognition_conditions [:host, :domain].each do |key| if conditions[key] operator = "===" if conditions[key].is_a?(Regexp) operator = "=~" end result &lt;&lt; "conditions[:#{key.to_s}] #{operator} env[:#{key.to_s}]" end end result end end# end class Route end end </pre></code></p> <p>My routes (just for development). You'll see my local development domain, stiltify.dev. Sorry, I tried to make it look good in here but I couldn't get the code block to look nice. I put it on pastie instead: <a href="http://pastie.org/940619" rel="nofollow noreferrer">http://pastie.org/940619</a>.</p> <p>The comments section in <a href="http://railscasts.com/episodes/123-subdomains" rel="nofollow noreferrer">Ryan Bates' screencast</a> was very helpful, and got me to figure out the subdomain => false and the other errors they were getting into. Still didn't fix the problem though!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload