# ActiveRecord problems after upgrade

**URL:** <https://www.ruby-forum.com/t/activerecord-problems-after-upgrade/159329>\
**Category:** Rails\
**Created:** [February 3, 2009, 3:05pm UTC](https://www.ruby-forum.com/t/activerecord-problems-after-upgrade/159329 "2009-02-03T15:05:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3d9bf3/32.png) [@Kenneth\_D](https://www.ruby-forum.com/u/Kenneth_D)\
**Post date:** [February 3, 2009, 3:05pm UTC](https://www.ruby-forum.com/t/activerecord-problems-after-upgrade/159329/1 "2009-02-03T15:05:51Z")

</div>

Hi

I have a rather large project that uses ActiveRecord both with Rails,  
and separately in various scripts. All has been working well until  
I upgraded from version 2.0.2 to version 2.2.2. Now, ActiveRecord  
doesn’t seem to be looking for the correct table. Here’s an example  
of what I’m seeing.

class ActiveRecord::Base  
def self.get\_dbconf  
conf = Hash.new  
IO.foreach("/etc/dbconf") do |line|  
next if line.length == 0  
name, data = line.split(": ")  
conf[name] = data.chomp  
end  
return conf  
end  
Conf = get\_dbconf  
end  
end

class Scode \< ActiveRecord::Base  
Scode.establish\_connection(self::Conf)  
end

irb(main):001:0\> require ‘scode’  
=\> true  
irb(main):002:0\> Scode  
=\> Scode(Table doesn’t exist)  
irb(main):003:0\> Scode.table\_name  
=\> “\e[4mScode\e[0ms”

I know I can set the table name manually, but if this simple mechanism  
is broken, how much other stuff is broken in this version?

Ken

–

I use the words you taught me. If they don’t mean anything any more,  
teach me others. Or let me be silent.  
Samuel Beckett (Clov, Endgame)

---

<div class="post-metadata">

**Author:** ![Kenneth\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3d9bf3/32.png) [@Kenneth\_D](https://www.ruby-forum.com/u/Kenneth_D)\
**Post date:** [February 3, 2009, 3:50pm UTC](https://www.ruby-forum.com/t/activerecord-problems-after-upgrade/159329/2 "2009-02-03T15:50:33Z")

</div>

On 3 Feb 2009, at 14:05, Kenneth D. wrote:

> irb(main):003:0\> Scode.table\_name  
> =\> “\e[4mScode\e[0ms”
> 
> I know I can set the table name manually, but if this simple mechanism  
> is broken, how much other stuff is broken in this version?

Something to do with the connection pooling changes ?

Fred

---

<div class="post-metadata">

**Author:** ![Kenneth\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3d9bf3/32.png) [@Kenneth\_D](https://www.ruby-forum.com/u/Kenneth_D)\
**Post date:** [February 3, 2009, 4:38pm UTC](https://www.ruby-forum.com/t/activerecord-problems-after-upgrade/159329/3 "2009-02-03T16:38:30Z")

</div>

Quoth Frederick C. (removed\_email\_address@domain.invalid):

> > =\> true  
> > irb(main):002:0\> Scode  
> > =\> Scode(Table doesn’t exist)  
> > irb(main):003:0\> Scode.table\_name  
> > =\> “\e[4mScode\e[0ms”
> > 
> > I know I can set the table name manually, but if this simple mechanism  
> > is broken, how much other stuff is broken in this version?
> 
> Something to do with the connection pooling changes ?

I think it may have something to do with changes to ActiveSupport.  
I notice that on my production system (v2.0.2), when I load an  
ActiveRecord class, the Inflector class is available:

irb(main):001:0\> require ‘scode’  
=\> true  
irb(main):002:0\> Inflector  
=\> Inflector

On the test system (v2.2.2), it is not:

irb(main):002:0\> require ‘scode’  
=\> true  
irb(main):003:0\> Inflector  
NameError: uninitialized constant Inflector  
from  
/pkg/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active\_support/dependencies.rb:445:in  
`load_missing_constant' from /pkg/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in`const\_missing’  
from  
/pkg/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active\_support/dependencies.rb:89:in  
`const\_missing’  
from (irb):3  
irb(main):004:0\> ActiveSupport::Inflector  
=\> ActiveSupport::Inflector

Ken

–

I use the words you taught me. If they don’t mean anything any more,  
teach me others. Or let me be silent.  
Samuel Beckett (Clov, Endgame)

---

<div class="post-metadata">

**Author:** ![Kenneth\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3d9bf3/32.png) [@Kenneth\_D](https://www.ruby-forum.com/u/Kenneth_D)\
**Post date:** [February 3, 2009, 7:33pm UTC](https://www.ruby-forum.com/t/activerecord-problems-after-upgrade/159329/4 "2009-02-03T19:33:57Z")

</div>

Quoth Frederick C. (removed\_email\_address@domain.invalid):

> > =\> true  
> > irb(main):002:0\> Scode  
> > =\> Scode(Table doesn’t exist)  
> > irb(main):003:0\> Scode.table\_name  
> > =\> “\e[4mScode\e[0ms”
> > 
> > I know I can set the table name manually, but if this simple mechanism  
> > is broken, how much other stuff is broken in this version?
> 
> Something to do with the connection pooling changes ?

In the end, the problem was fixed by moving a require (which requires  
a class completely unrelated to ActiveRecord anything) _above_ the  
require which pulls in my activerecord classes.

Can’t say that I much like the fragility of the arrangement.

## Ken

I use the words you taught me. If they don’t mean anything any more,  
teach me others. Or let me be silent.  
Samuel Beckett (Clov, Endgame)
