本地测试手机版后台没问题 可是到了线上就无法访问到 http://域名/admin 的手机版
代码: 1.application_controller.rb
class ApplicationController < ActionController::Base
#protect_from_forgery # :secret => 'd7f14b6ea460ab510ef00c7049c8bb56'
helper :all
include SimpleCaptcha::ControllerHelpers
if RAILS_ENV == "development" #用于判断运行环境
has_mobile_fu(true) #使用插件,判断当前请求是否是手机
else
has_mobile_fu
end
.......
end
2.admin:dashboard_controller.rb
class Admin::DashboardController < Admin::BaseController
before_filter :login_required, :only => [:index]
if RAILS_ENV == "development"
has_mobile_fu(true)
else
has_mobile_fu
end
....
end
3.routes.rb
ActionController::Routing::Routes.draw do |map|
map.namespace 'admin' do |admin|
admin.dashboard '/', :controller => 'dashboard'
end
..........
end
4.admin.mobile.erb
<html>
<head>
<meta charset="UTF-8">
<title><%= Setting.site_name %>超管平台 - <%= yield :title -%></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="description" content="<%= yield :description or h(@group.try(:description)) %>">
<meta name="author" content="<%= yield :author %>">
<meta name="keywords" content="<%= yield :keywords %>">
<%= csrf_meta_tag %>
<%= stylesheet_link_tag 'admin_mobile', 'pagination_mobile' %>
</head>
<body>
<div class="navbar_m">
<!-- Setting.site_name || 'Admin' ,:style=>"padding:8px 0px 12px;" -->
<div id="nav-left">
<%= link_to ("admin"), admin_dashboard_path, :class => 'brand' %>
</div>
<div id="nav-right">
<%#= link_to current_user.login, [:admin, current_user] %>
<%= link_to current_user.login, admin_user_path(current_user)%>
<%= link_to("退出", logout_path)%>
</div>
</div>
..........
<body>
</html>