Created
November 18, 2010 22:35
-
-
Save clemens/705804 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When the constraints block is active, I get RoutingError: No route matches "/" when going to localhost:3000. If I comment the block out, it works just fine. But I need both: | |
http://example.com should render PagesController#show with params[:permalink] being 'index' | |
http://clemensk.example.com should render ProfilesController#show | |
Hints anyone? | |
Thanks! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constraints(Subdomain) do | |
match '/', :to => 'profiles#show', :as => :profile # works! | |
end | |
match '/', :to => 'pages#show', :permalink => 'index' # shortcut root :to => 'pages#show' – either doesn't work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from railscasts.com | |
class Subdomain | |
def self.matches?(request) | |
i = Rails.env.development? ? 0 : 1 # so I can use localhost:3000 | |
request.subdomain(i).present? && request.subdomain(i) != "www" | |
end | |
end |
I've put the problem on hold because I had other things to do. I'll probably send a patch if the problem really is in routing filter or post an alternative solution.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just ran into this same problem. Did you ever figure out how to make routing-filter respect constraints?