1

更新 Mongoid 3.0.1 / Rails 3.2.6 后,在显示 created_at 时开始出现“getlocal”方法错误:

Showing /home/lsoave/rails/github/gitwatcher/app/views/shared/_watch-list-table.html.haml where line #28 raised: 

undefined method `getlocal' for "2008-02-14T02:20:50Z":String

Extracted source (around line #28): 

28:           %td= repo.created_at.to_s(:pretty)

更新

我有一个设置该格式的 config/initializers/time_formats.rb

$ cat config/initializers/time_formats.rb

Time::DATE_FORMATS[:month_and_year] = "%B %Y"
Time::DATE_FORMATS[:pretty] = lambda { |time| time.strftime("%a, %b %e at %l:%M") + time.strftime("%p").downcase }

repo.created_at无论如何,只需调用(省略.to_s(:pretty))也会发生错误

更新

我刚刚在 RVM/Ruby - Rails - Mongoid 堆栈上尝试了回滚,但没有成功:

from ruby-1.9.3-p194@rails-3.2.6 to ruby-1.9.2-p290@rails-3.2.3

from Mongoid 3.0.1 to Mongoid 2.4.3

from Rails 3.2.6 to Rails 3.2.3 

见 RVM 输出:

lsoave@ubuntu:~/rails/tests/gitwatcher$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
lsoave@ubuntu:~/rails/tests/gitwatcher$ rvm list

rvm rubies

=> ruby-1.9.2-p290 [ i686 ]
 * ruby-1.9.3-p194 [ i686 ]

# => - current
# =* - current && default
#  * - default

lsoave@ubuntu:~/rails/tests/gitwatcher$ rvm gemset list

gemsets for ruby-1.9.2-p290 (found in /home/lsoave/.rvm/gems/ruby-1.9.2-p290)
   global
=> rails-3.2.3

lsoave@ubuntu:~/rails/tests/gitwatcher$ 

......我客人在这一点上是ENV级别的东西,但是什么?

4

1 回答 1

1

也许您的数据中的某些内容已损坏。

于 2012-07-21T16:26:51.553 回答