0

我被这个奇怪的问题困住了。此问题仅在生产服务器中,在本地服务器上可以正常工作。

我检查了我的生产日志,发现错误出现在以下行:

ActionView::Template::Error(nil:NilClass 的未定义方法 `full_name')

但是当我刷新浏览器时,错误消失了,页面加载正常。我不确定是什么导致了错误。

这是我的日志:

Started GET "/advertisements" for 182.93.88.6 at 2013-07-13 23:47:39 -0700
Processing by AdvertisementsController#index as HTML
  Rendered shared/_profile_menu.html.erb (37.8ms)
  Rendered advertisements/index.html.erb within layouts/application (38.1ms)
Completed 500 Internal Server Error in 40ms

ActionView::Template::Error (undefined method `full_name' for nil:NilClass):
    4:       <div class="six columns">
    5:         <ul class="breadcrumbs hide-for-small">
    6:           <li><a href="<%= root_url%>">Home</a></li>
    7:           <li class="current">
    8:               <% if current_user %>
    9:               <%= link_to "#{current_user.full_name unless current_user.full_name.nil?}", user_path(current_user) %>
    10:               <% else %>
  app/views/shared/_profile_menu.html.erb:7:in `_app_views_shared__profile_menu_html_erb__3873584509912802681_40734020'
  app/views/advertisements/index.html.erb:1:in `_app_views_advertisements_index_html_erb___4140482918641285695_46665240'


Started GET "/advertisements" for 182.93.88.6 at 2013-07-13 23:47:41 -0700
Processing by AdvertisementsController#index as HTML
  Rendered shared/_profile_menu.html.erb (1.4ms)
  Rendered advertisements/index.html.erb within layouts/application (5.5ms)
  Rendered shared/_head.html.erb (0.9ms)
  Rendered shared/_top_link.html.erb (0.0ms)
  Rendered shared/_logo.html.erb (0.5ms)
  Rendered shared/_header.html.erb (0.9ms)
  Rendered shared/_footer.html.erb (6.6ms)
  Rendered shared/_popups.html.erb (0.0ms)
Completed 200 OK in 17ms (Views: 14.4ms | ActiveRecord: 1.2ms)

我正在使用设计来管理用户登录,并且 full_name 在 user.rb 模型中设置为可访问属性,如下所示:

attr_accessible :full_name

服务器环境设置有 nginx、unicorn、capistrano 和 mysql 数据库。任何帮助将不胜感激。提前致谢。

4

1 回答 1

0

看起来有某种服务器问题。我重新部署了应用程序,一切正常。

于 2013-07-15T09:40:15.393 回答