# Error with Rails and DBI::Date

**URL:** <https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429>\
**Category:** IronRuby\
**Created:** [May 11, 2010, 8:41pm UTC](https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429 "2010-05-11T20:41:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [May 11, 2010, 8:41pm UTC](https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429/1 "2010-05-11T20:41:40Z")

</div>

Hi guys,

I’m on a new computer and I’m trying to run rails (via IronRuby) for the  
first time here.  
I have installed the rake, rails and activerecord-adonet-sqlserver gems,  
added the config.gem line to environment.rb and updated the database.yml  
file.

As soon as I try to run the WEBrick I get the next exception:  
‘alias\_method’: undefined method `public' for class`DBI::Date’  
(NameError)

This is caused because of line 57 in the date.rb file of the DBI gem:  
deprecate :initialize, :public

I replaced the DBI gem with Ivan’s Ironruby-dbi gem but it didn’t help.

Has anyone run into this problem?

Thanks,  
Shay.

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [May 12, 2010, 9:15am UTC](https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429/2 "2010-05-12T09:15:09Z")

</div>

It turned out to be some kind of a gem versions mess… Had to uninstall  
several gems and reinstall them to get it going.

Shay.

Shay F. wrote:

> Hi guys,
> 
> I’m on a new computer and I’m trying to run rails (via IronRuby) for the  
> first time here.  
> I have installed the rake, rails and activerecord-adonet-sqlserver gems,  
> added the config.gem line to environment.rb and updated the database.yml  
> file.
> 
> As soon as I try to run the WEBrick I get the next exception:  
> ‘alias\_method’: undefined method `public' for class `DBI::Date’  
> (NameError)
> 
> This is caused because of line 57 in the date.rb file of the DBI gem:  
> deprecate :initialize, :public
> 
> I replaced the DBI gem with Ivan’s Ironruby-dbi gem but it didn’t help.
> 
> Has anyone run into this problem?
> 
> Thanks,  
> Shay.

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [August 3, 2010, 4:52am UTC](https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429/3 "2010-08-03T04:52:52Z")

</div>

Hi Shay,

I am facing the same problem. Could you find out which versions of these  
gems you need to reinstall? Here is my list:

Successfully installed deprecated-3.0.0  
Successfully installed dbi-0.4.3  
Successfully installed dbd-adonet-0.3.2  
Successfully installed dbd-adonet-sqlserver-0.3.2  
Successfully installed activerecord-sqlserver-adapter-2.3.1  
Successfully installed activerecord-adonet-sqlserver-0.3.4

I am running rails 2.3.8, btw.

Cheers,  
Jack  
Shay F. wrote:

> It turned out to be some kind of a gem versions mess… Had to uninstall  
> several gems and reinstall them to get it going.
> 
> Shay.
> 
> Shay F. wrote:
> 
> > Hi guys,
> > 
> > I’m on a new computer and I’m trying to run rails (via IronRuby) for the  
> > first time here.  
> > I have installed the rake, rails and activerecord-adonet-sqlserver gems,  
> > added the config.gem line to environment.rb and updated the database.yml  
> > file.
> > 
> > As soon as I try to run the WEBrick I get the next exception:  
> > ‘alias\_method’: undefined method `public' for class `DBI::Date’  
> > (NameError)
> > 
> > This is caused because of line 57 in the date.rb file of the DBI gem:  
> > deprecate :initialize, :public
> > 
> > I replaced the DBI gem with Ivan’s Ironruby-dbi gem but it didn’t help.
> > 
> > Has anyone run into this problem?
> > 
> > Thanks,  
> > Shay.

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [August 3, 2010, 10:30am UTC](https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429/4 "2010-08-03T10:30:02Z")

</div>

I’ve reinstalled IR since then so I don’t have the list now. I remember  
it  
was something with the deprecated gem… try to install a previous  
version  
of it.

Not sure though. I’ll have time to look into it only in a few days.  
Has someone here run into this problem, fixed it and have the solution  
at  
hand?

Shay.

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [August 8, 2010, 10:52pm UTC](https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429/5 "2010-08-08T22:52:12Z")

</div>

activerecord-sqlserver-adapter now supports IronRuby directly, and does  
not  
depend on any of the DBI gems (I update  
[http://ironruby.net/documentation/rails](http://ironruby.net/documentation/rails) a while ago with this). Try just  
installing activerecord-sqlserver-adapter-2.3.8 without any of those DBI  
gems, as they might be doing something incompatible with DBI::Date.

~Jimmy

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [August 25, 2010, 12:13am UTC](https://www.ruby-forum.com/t/error-with-rails-and-dbi-date/188429/6 "2010-08-25T00:13:46Z")

</div>

I had a similar problem on a machine that had deprecated version 3.0.0  
on it. I uninstalled it (it also had version 2.0.1 that is on the rest  
of my machines) and the problem was resolved.

-rob
