Pergunta

I have different views for desktop and mobile site. If site is opened from mobile device then it will be redirected to m.domain_name

root :to => "home#index", constraints: {subdomain: 'm'||'m.staging'}
root :to => 'desktop#index'

It works fine for 'm' subdomain however it isn't working for m.staging subdomain

Foi útil?

Solução

If you use Request based constraint, the request property should return String, not true/false. Try the same using a lambda,

root :to => "home#index",
constraints: lambda { |request| ['m','m.staging'].include?(request.subdomain) }
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top