ActionView :: Template :: Error(未定义方法`getlocal'for“2008-02-14T02:20:50Z”:String): [英] ActionView::Template::Error (undefined method `getlocal' for "2008-02-14T02:20:50Z":String):

查看:104
本文介绍了ActionView :: Template :: Error(未定义方法`getlocal'for“2008-02-14T02:20:50Z”:String):的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在更新Mongoid 3.0.1 / Rails 3.2.6后,它显示created_at时会出现'getlocal'方法错误:

 显示/home/lsoave/rails/github/gitwatcher/app/views/shared/_watch-list-table.html.haml其中第28行提出:

未定义方法`getlocal'for2008 -02-14T02:20:50Z:字符串

提取的源代码(在第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 

从Mongoid 3.0.1到Mongoid 2.4.3

从Rails 3.2.6到Rails 3.2.3

查看RVM输出:

  lsoave @ ubuntu:〜/ rails / tests / gitwatcher $ ruby​​ -v 
ruby​​ 1.9.2p290(2011-07-09修订版32553)[i686-linux]
lsoave @ ubuntu:〜/ rails / tests / gitwatcher $ rvm list

rvm rubies

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

#=> - 当前
#= * - 当前&&默认
#* - 默认

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

gemsets for ruby​​-1.9.2-p290(在/home/lsoave/.rvm/gems/ruby-1.9.2-p290中找到)
global
=> rails-3.2.3

lsoave @ ubuntu:〜/ rails / tests / gitwatcher

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

您的数据已损坏。

After updating Mongoid 3.0.1 / Rails 3.2.6 it start getting a 'getlocal' method error when displaying created_at :

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

I've got a config/initializers/time_formats.rb which set that format

$ 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 }

anyway the error happen also by simply call repo.created_at (omitting .to_s(:pretty))

UPDATE

I just tried a rollback, on RVM/Ruby - Rails - Mongoid stack without success :

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 

see RVM output :

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$ 

... I guest that is something at ENV level at this point, but what ?

解决方案

Maybe something with your data got corrupt.

这篇关于ActionView :: Template :: Error(未定义方法`getlocal'for“2008-02-14T02:20:50Z”:String):的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆