我在我的 Rails 应用程序中使用 Twitter Bootstrap。我最近开始遇到一个问题,如果我从 Firefox 调用该应用程序,一切正常,如果我从我的 iPhone 或 Chrome 调用它,它就会失败。
下面是测试服务器日志文件的相关信息:
当我尝试使用 iPhone 或 Chrome 时:
Started GET "/" for xx.xxx.xxx.xx at 2013-06-18 18:20:58 +0000
Processing by PagesController#home as HTML
BlogPost Load (0.3ms) SELECT `blog_posts`.* FROM `blog_posts`
Rendered pages/home.html.erb within layouts/application (78.0ms)
Rendered layouts/_shim.html.erb (0.4ms)
Rendered layouts/_header.html.erb (3.5ms)
Rendered layouts/_promo_bar.html.erb (65.5ms)
Completed 500 Internal Server Error in 539ms
当我使用 Firefox 时:
Started GET "/" for xx.xxx.xx.xx at 2013-06-18 18:21:43 +0000
User Load (55.1ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1
Processing by PagesController#home as HTML
BlogPost Load (2.3ms) SELECT `blog_posts`.* FROM `blog_posts`
Rendered pages/home.html.erb within layouts/application (16.9ms)
Rendered layouts/_shim.html.erb (0.4ms)
Rendered layouts/_header.html.erb (7.4ms)
User Load (8.8ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2
User Load (6.5ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = 'mine@mydomain.com'
Rendered layouts/_promo_bar.html.erb (14.8ms)
Rendered layouts/_footer.html.erb (8.7ms)
Completed 200 OK in 566ms (Views: 362.7ms | ActiveRecord: 81.0ms)
因此,它在处理 layouts/_footer.html.erb 时失败了。请注意,这是唯一使用 Twitter Boostrap 功能的文件。以下是布局/_footer.html.erb
<% admin = nil %>
<% if user_signed_in? %>
<% roles = array_from_json(current_user.role) %>
<% if roles.include?("admin") %>
<% admin = TRUE %>
<% end %>
<% end %>
<footer class="footer">
<div class="footer_column left_padding">
<ul class="footer_column_list">
<li class="footer_column_header"><%= link_to "About", about_path %></li>
<li><%= link_to "Mission", about_path %> </li>
<li><%= link_to "Team", our_team_path %> </li>
<li><%= link_to "Advisory Board", advisors_path %> </li>
</ul>
</div>
<div class="footer_column">
<ul class="footer_column_list">
<li class="footer_column_header"><%= link_to "Conference", event_path(Current_event_id.to_s) %></li>
<li><%= link_to "Description", event_path(Current_event_id.to_s) %></li>
<li><%= link_to "Speakers", speakers_path %></li>
<li><%= link_to "Schedule", schedule_path %></li>
<li><%= link_to "Travel Information", travel_path %></li>
<li><%= link_to REQUEST_INVITE_TITLE, new_user_registration_path %></li>
</ul>
</div>
<% if admin %>
<div class="footer_column">
<ul class="footer_column_list">
<li class="dropdown" id="admin_menu">
<a class="footer_column_header" data-toggle="dropdown" data-target="#admin_menu">
<%= ADMIN_TITLE %>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<% Admin_menu.each do |menu_text, menu_action| %>
<li><a href="<%= menu_action %>"><%= menu_text %></a></li>
<% end %>
</ul>
</li>
</ul>
</div>
<% else %>
<div class="footer_column">
<ul class="footer_column_list">
<li class="footer_column_header">Admin Functions</li>
<li><%= link_to "Admin log-in", new_user_session_path %></li>
</ul>
</div>
<% end %>
<div class="footer_column">
<ul class="footer_column_list last_on_right">
<li class="footer_column_header"><%= link_to "Blog", "http://ourblogg.com/" %></li>
<li><%= image_tag('facebook-icon.png') %> <%= link_to "Facebook", "http://www.facebook.com/ourfbaccount" %></li>
<li><%= image_tag('twitter-icon.png') %> <%= link_to "Twitter", "http://twitter.com/ourtwacct" %></li>
</ul>
</div>
</footer>
这可能是 Twitter Bootstrap 问题,如果是这样,有什么解决方法的想法吗?
附加说明:
当我在测试服务器上预编译资产时:
RAILS_ENV=test bundle exec rake assets:precompile
我收到以下警告:
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.6