21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/mobile_views_controller.rb', line 21
def has_mobile_views
if request.subdomain != 'm' && mobile_device?
if request.host =~ /\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b|localhost/
raise Exception, "Can't redirect to subdomain 'm.#{request.host}'! Please use e.g. lvh.me"
else
redirect_to request.protocol + "m." + request.host_with_port + request.fullpath
end
end
session[:mobile] = params[:mobile] if params[:mobile]
request.format = :mobile if mobile_device?
end
|