# Undefined method \`inject' for true:TrueClass

**URL:** <https://www.ruby-forum.com/t/undefined-method-inject-for-true-trueclass/194231>\
**Category:** Rails\
**Created:** [September 1, 2010, 12:01pm UTC](https://www.ruby-forum.com/t/undefined-method-inject-for-true-trueclass/194231 "2010-09-01T12:01:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [September 1, 2010, 12:01pm UTC](https://www.ruby-forum.com/t/undefined-method-inject-for-true-trueclass/194231/1 "2010-09-01T12:01:01Z")

</div>

I just updated my Rubygems and rails2.3.2.

Everything was working prior to this update. Now I am getting this  
error:

undefined method `inject’ for true:TrueClass

I don’t have the faintest idea why and I certainly don’t know what the  
‘inject’ method is or where it is called etc. Nor do I know what the  
TrueClass is.

Can anyone please help.

The full trace is below:

/Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:206:in  
`deep_symbolize_keys' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:197:in`merge\_translations’  
/Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:177:in  
`load_file' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:177:in`each’  
/Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:177:in  
`load_file' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in`load\_translations’  
/Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in  
`each' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in`load\_translations’  
/Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:85:in  
`init_translations' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:100:in`lookup’  
/Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:33:in  
`translate' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:165:in`translate’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/translation.rb:4:in  
`t' /Users/mitch/railsprojects/gould_development/app/controllers/public_controller.rb:7:in`home’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/base.rb:1322:in  
`send' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/base.rb:1322:in`perform\_action\_without\_filters’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/filters.rb:617:in  
`call_filters' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/filters.rb:610:in`perform\_action\_without\_benchmark’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/benchmarking.rb:68:in  
`perform_action_without_rescue' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:17:in`ms’  
/Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/core\_ext/benchmark.rb:10:in  
`realtime' /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:17:in`ms’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/benchmarking.rb:68:in  
`perform_action_without_rescue' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:160:in`perform\_action\_without\_flash’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/flash.rb:141:in  
`perform_action' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/base.rb:523:in`send’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/base.rb:523:in  
`process_without_filters' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/filters.rb:606:in`process’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/base.rb:391:in  
`process' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/base.rb:386:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/routing/route\_set.rb:433:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:88:in`dispatch’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/dispatcher.rb:111:in  
`_call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:82:in`initialize’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/vendor/rack-1.0/rack/head.rb:9:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/head.rb:9:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/vendor/rack-1.0/rack/methodoverride.rb:24:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/params_parser.rb:15:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/rewindable\_input.rb:25:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/session/abstract_store.rb:122:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active\_record/query\_cache.rb:29:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in`cache’  
/Users/mitch/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active\_record/query\_cache.rb:9:in  
`cache' /Users/mitch/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:28:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/activerecord-2.3.2/lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:361:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/reloader.rb:9:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/failsafe.rb:11:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/vendor/rack-1.0/rack/lock.rb:11:in  
`synchronize' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/dispatcher.rb:106:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/rails-2.3.2/lib/rails/rack/static.rb:31:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/vendor/rack-1.0/rack/urlmap.rb:46:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb:40:in`each’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/vendor/rack-1.0/rack/urlmap.rb:40:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/rails-2.3.2/lib/rails/rack/log_tailer.rb:17:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/vendor/rack-1.0/rack/content\_length.rb:13:in  
`call' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/chunked.rb:15:in`call’  
/Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action\_controller/vendor/rack-1.0/rack/handler/mongrel.rb:61:in  
`process' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:in`process\_client’  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in  
`each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in`process\_client’  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in  
`run' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in`initialize’  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in  
`new' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in`run’  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in  
`initialize' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in`new’  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in  
`run' /Users/mitch/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb:34:in`run’  
/Users/mitch/.gem/ruby/1.8/gems/rails-2.3.2/lib/commands/server.rb:111  
/Library/Ruby/Site/1.8/rubygems/custom\_require.rb:31:in  
`gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in`require’  
script/server:3

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [September 1, 2010, 12:50pm UTC](https://www.ruby-forum.com/t/undefined-method-inject-for-true-trueclass/194231/2 "2010-09-01T12:50:28Z")

</div>

Hi –

On Wed, 1 Sep 2010, Mitchell G. wrote:

> Can anyone please help.

[http://www.manning.black2](http://www.manning.black2) 🙂

> The full trace is below:
> 
> /Users/mitch/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active\_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:206:in

That’s where inject is being called.

> /Users/mitch/railsprojects/gould\_development/app/controllers/public\_controller.rb:7:in  
> `home’

What does that method look like?

David

–  
David A. Black, Senior Developer, Cyrus Innovation Inc.

The Ruby training with Black/Brown/McAnally  
Compleat Philadelphia, PA, October 1-2, 2010  
Rubyist [http://www.compleatrubyist.com](http://www.compleatrubyist.com)

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [September 1, 2010, 5:20pm UTC](https://www.ruby-forum.com/t/undefined-method-inject-for-true-trueclass/194231/3 "2010-09-01T17:20:09Z")

</div>

Mitchell G. wrote:

> I just updated my Rubygems and rails2.3.2.
> 
> Everything was working prior to this update. Now I am getting this  
> error:
> 
> undefined method `inject’ for true:TrueClass
> 
> I don’t have the faintest idea why and I certainly don’t know what the  
> ‘inject’ method is or where it is called etc. Nor do I know what the  
> TrueClass is.

Looking at the Ruby core and standard library documentation would answer  
both those questions for you.

> Can anyone please help.
> 
> The full trace is below:  
> […]

David already gave you some guidance on how to read the stack trace;  
looks like Rails is calling inject on an object for which it’s not  
defined. Good luck! Let us know if you have further questions…

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [September 1, 2010, 5:52pm UTC](https://www.ruby-forum.com/t/undefined-method-inject-for-true-trueclass/194231/4 "2010-09-01T17:52:37Z")

</div>

On Sep 1, 11:01 am, Mitchell G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

At a guess rails doesn’t like some of your translation data - i’d look  
very carefully at any of the translation data used by line 7 of your  
public controller. TrueClass is the class that true is an (in fact  
the only) instance of.

Fred
