::的ActionView模板::错误(未定义的方法`的getLocal”为‘2008-02-14T

2019-09-29 05:51发布

更新Mongoid 3.0.1后/滑轨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)

UPDATE

我有一个配置/初始化/ 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(:漂亮))

UPDATE

我只是想回退,在RVM /红宝石 - 导轨 - 没有成功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的水平在这一点上,但什么?

Answer 1:

也许一些与您的数据得到了损坏。



文章来源: ActionView::Template::Error (undefined method `getlocal' for “2008-02-14T02:20:50Z”:String):