Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ActionView::Template::Error(针对“2008-02-14T02:20:50Z”字符串的未定义方法“getlocal'”):_Ruby On Rails_Ruby_Rubygems_Mongoid_Rvm - Fatal编程技术网

Ruby on rails ActionView::Template::Error(针对“2008-02-14T02:20:50Z”字符串的未定义方法“getlocal'”):

Ruby on rails ActionView::Template::Error(针对“2008-02-14T02:20:50Z”字符串的未定义方法“getlocal'”):,ruby-on-rails,ruby,rubygems,mongoid,rvm,Ruby On Rails,Ruby,Rubygems,Mongoid,Rvm,更新Mongoid 3.0.1/Rails 3.2.6后,在以下位置显示创建的\u时,它开始出现“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 Extracte

更新Mongoid 3.0.1/Rails 3.2.6后,在以下位置显示创建的\u时,它开始出现“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(省略.to(: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$ 

。。。我认为这是环境级别的问题,但是什么呢?

可能是您的数据被破坏了

可能您的数据有问题

你的时间格式:pretty是什么样子的?我有一个config/initializers/time_formats.rb设置了这个格式(见更新)我会关注这个论坛,这可能是一个潜在的错误:你的数据中可能有重复的东西被破坏了。你的时间格式:pretty看起来像什么?我有一个config/initializers/time_formats.rb设置了该格式(见更新)我会关注这个论坛,这可能是一个潜在的错误:可能有重复的东西被破坏了。