"Media query" in a controller?

Is there a way to do what would be equivalent to a css media query in a controller in order to decide which erb template to use when rendering a page?

No, and maybe.

First, go to <http://www.w3.org/TR/css3-mediaqueries/> and see the
"media features" on which media queries are based.

Then examine a few http requests from a browser -- do you see any
"media features" values in the request? If not, the answer is "no".

However, if you control the page being linked from, you can certainly
pack any data into the request you want, though that has downsides
as well (sharing URLs, bookmarking).


What are you trying to achieve? If it is around picking up a different template based on device type of the user, you can use the user agent field passed along with each request to render different templates.