Redmine:用户配置文件视图中的错误

时间:2012-02-01 13:56:04

标签: redmine

我收到此错误:

Processing MyController#account (for 127.0.0.1 at 2012-01-31 13:22:55) [GET]
  Parameters: {"action"=>"account", "controller"=>"my"}
Rendering template within layouts/base
Rendering my/account

ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #11 of app/views/my/_sidebar.html.erb:
8: 
9: <p>
10: <% if @user.rss_token %>
11: <%= l(:label_feeds_access_key_created_on, distance_of_time_in_words(Time.now, @user.rss_token.created_on)) %>
12: <% else %>
13: <%= l(:label_missing_feeds_access_key) %>
14: <% end %>

    app/views/my/_sidebar.html.erb:11
    app/views/my/account.html.erb:48
    app/helpers/application_helper.rb:980:in `content_for'
    app/views/my/account.html.erb:47
    /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:528:in `process_client'
    /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:600:in `worker_loop'
    /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:485:in `spawn_missing_workers'
    /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:135:in `start'
    /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/bin/unicorn_rails:209
    /home/redmine/redmine-buildout/parts/rubygems/bin/unicorn_rails:19:in `load'
    /home/redmine/redmine-buildout/parts/rubygems/bin/unicorn_rails:19

Rendering /home/redmine/redmine-buildout/parts/redmine/public/500.html (500 Internal Server Error)
某些用户(并非所有用户)在尝试查看/ my / account时

如果我尝试将该用户的个人资料视为管理员,我会:

Processing UsersController#show (for 2.157.30.187 at 2012-02-01 14:26:40) [GET]
  Parameters: {"action"=>"show", "id"=>"9", "controller"=>"users"}

NoMethodError (undefined method `<=>' for nil:NilClass):
  lib/redmine/activity/fetcher.rb:80:in `events'
  lib/redmine/activity/fetcher.rb:80:in `sort!'
  lib/redmine/activity/fetcher.rb:80:in `events'
  app/controllers/users_controller.rb:74:in `show'
  /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:528:in `process_client'
  /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:600:in `worker_loop'
  /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:485:in `spawn_missing_workers'
  /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/lib/unicorn/http_server.rb:135:in `start'
  /home/redmine/redmine-buildout/parts/rubygems/lib/ruby/gems/1.8/gems/unicorn-4.1.1/bin/unicorn_rails:209
  /home/redmine/redmine-buildout/parts/rubygems/bin/unicorn_rails:19:in `load'
  /home/redmine/redmine-buildout/parts/rubygems/bin/unicorn_rails:19

Rendering /home/redmine/redmine-buildout/parts/redmine/public/500.html (500 Internal Server Error)

我(未受过教育)的猜测是用户错过了一个rss身份验证令牌。

如果是这种情况,你能指点一些关于如何重新生成它的文档吗?

2 个答案:

答案 0 :(得分:2)

你最近升级了Redmine吗?

为了安全起见,我建议运行升级后迁移,以确保所有表都设置正确。

rake generate_session_store
rake db:migrate RAILS_ENV=production
rake db:migrate_plugins RAILS_ENV=production
rake tmp:cache:clear
rake tmp:sessions:clear

命令完成后,重新启动Web服务器,看看是否有帮助。

答案 1 :(得分:0)

postgresql和redmine之间对字符串日期格式的误解似乎是根本原因(请参阅我对Declan Lynch答案的评论)。

ALTER DATABASE redmine SET DATESTYLE=US;

解决了我所有的问题。