{"id":483,"date":"2022-08-30T15:02:06","date_gmt":"2022-08-30T15:02:06","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/actionviewtemplateerror-undefined-method-getlocal-for-2008-02-14t022050zstring-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:02:06","modified_gmt":"2022-08-30T15:02:06","slug":"actionviewtemplateerror-undefined-method-getlocal-for-2008-02-14t022050zstring-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/actionviewtemplateerror-undefined-method-getlocal-for-2008-02-14t022050zstring-collection-of-common-programming-errors\/","title":{"rendered":"ActionView::Template::Error (undefined method `getlocal&#39; for &ldquo;2008-02-14T02:20:50Z&rdquo;:String):-Collection of common programming errors"},"content":{"rendered":"<p>After updating Mongoid 3.0.1 \/ Rails 3.2.6 it start getting a &#8216;getlocal&#8217; method error when displaying created_at :<\/p>\n<pre><code>Showing \/home\/lsoave\/rails\/github\/gitwatcher\/app\/views\/shared\/_watch-list-table.html.haml where line #28 raised: \n\nundefined method `getlocal' for \"2008-02-14T02:20:50Z\":String\n\nExtracted source (around line #28): \n\n28:           %td= repo.created_at.to_s(:pretty)\n<\/code><\/pre>\n<p>UPDATE<\/p>\n<p>I&#8217;ve got a config\/initializers\/time_formats.rb which set that format<\/p>\n<pre><code>$ cat config\/initializers\/time_formats.rb\n\nTime::DATE_FORMATS[:month_and_year] = \"%B %Y\"\nTime::DATE_FORMATS[:pretty] = lambda { |time| time.strftime(\"%a, %b %e at %l:%M\") + time.strftime(\"%p\").downcase }\n<\/code><\/pre>\n<p>anyway the error happen also by simply call <code>repo.created_at<\/code> (omitting .to_s(:pretty))<\/p>\n<p>UPDATE<\/p>\n<p>I just tried a rollback, on RVM\/Ruby &#8211; Rails &#8211; Mongoid stack without success :<\/p>\n<pre><code>from ruby-1.9.3-p194@rails-3.2.6 to ruby-1.9.2-p290@rails-3.2.3\n\nfrom Mongoid 3.0.1 to Mongoid 2.4.3\n\nfrom Rails 3.2.6 to Rails 3.2.3 \n<\/code><\/pre>\n<p>see RVM output :<\/p>\n<pre><code>lsoave@ubuntu:~\/rails\/tests\/gitwatcher$ ruby -v\nruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]\nlsoave@ubuntu:~\/rails\/tests\/gitwatcher$ rvm list\n\nrvm rubies\n\n=&gt; ruby-1.9.2-p290 [ i686 ]\n * ruby-1.9.3-p194 [ i686 ]\n\n# =&gt; - current\n# =* - current &amp;&amp; default\n#  * - default\n\nlsoave@ubuntu:~\/rails\/tests\/gitwatcher$ rvm gemset list\n\ngemsets for ruby-1.9.2-p290 (found in \/home\/lsoave\/.rvm\/gems\/ruby-1.9.2-p290)\n   global\n=&gt; rails-3.2.3\n\nlsoave@ubuntu:~\/rails\/tests\/gitwatcher$ \n<\/code><\/pre>\n<p>&#8230; I guest that is something at ENV level at this point, but what ?<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 19:45:12. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>After updating Mongoid 3.0.1 \/ Rails 3.2.6 it start getting a &#8216;getlocal&#8217; 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&#8217; for &#8220;2008-02-14T02:20:50Z&#8221;:String Extracted source (around line #28): 28: %td= repo.created_at.to_s(:pretty) UPDATE I&#8217;ve got a config\/initializers\/time_formats.rb which set that format $ cat config\/initializers\/time_formats.rb Time::DATE_FORMATS[:month_and_year] = &#8220;%B %Y&#8221; Time::DATE_FORMATS[:pretty] = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-483","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=483"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/483\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}