Skip to content


Subversion checkout URL

You can clone with
Download ZIP


'host' constraint not working #27

stephanvane opened this Issue · 4 comments

2 participants


Hello, I tried using constraints host: '' in my routes.rb. I think this problem is closely related to #12. Adding conditions[:host] = route.constraints[:host] if route.constraints would work.

I guess that since there could be more constraints a more general solution is in it's place. Replacing the #12 fix with:

if route.constraints
  route.constraints.each do |k,v|
    conditions[k] = v unless k == :request_method

works for me. (request_method is left out since it resulted in an error).

I'm not sure if my method introduces new problems. If it does, then a simple conditions[:host] = route.constraints[:host] if route.constraints instead would to the trick.


It looks good to me, did you try it out? I'll make the changes and run a few test asap. Thanks.


I tested it on my own project and I didn't see any problems with it. I guess it'll work just fine everywhere. Some double checking couldn't hurt though :) I'm far from an expert on rails routing

@stephanvane stephanvane referenced this issue from a commit in stephanvane/rails-translate-routes
@stephanvane stephanvane fixed issue #27 eabd852

I'll try to release it today or next tuesday. Thanks!


Thanks you
I'll use my branch of the gem in the meantime so take your time :)
Great project btw, thanks for the work!

@francesc francesc closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.