ruby on rails - Why does this route globpattern in routes.rb not match the url? -
i have pattern in routes.rb file:
match '/*', to: 'codeopenhub#index', constraints: { subdomain: 'code' }, via: :get
when hit url code.lvh.me:3000
, takes me incorrect landing page. similarly, when try request nonexistent url http://code.lvh.me:3000/abc
, 404
. makes sense page doesn't exist wouldn't have been routed codeopenhub#index
page? before had get '/', to: 'codeopenhub#index', constraints: { subdomain: 'code' }
correctly takes me landing page want. when try code.openhub.net/foo
takes me wrong page.
how can route request code.openhub.net/abc
or code.openhub.net/foo
codeopenhubcontroller#index
method?
----update------
i've tried add more parameters constraints
hash such as:
get '/:id', to: 'codeopenhub#index', constraints: { subdomain: 'code', id: /[a-za-z]/ }
but still did not work.
Comments
Post a Comment