0

New to Rails here. I got a short script in Rails at detectmobilebrowsers.com to check and redirect mobile browsers. It looks like:

def redirect_mobile(url = "http://detectmobilebrowser.com/mobile") redirect_to url ..... ..... (request.user_agent[0..3]) end

It looks like this is one big function. Where should I put this in the typical Rails directory structure (app with controller, helpers, models subdirectories / components / config / etc) so that when a user accesses the front page (index), they'll get redirected to a certain mobile address?

Thanks!

4

1 に答える 1