Ruby error - cannot find ruby gem active record

Discussion in 'Ruby' started by jmilunsky@hotmail.com, Jul 25, 2007.

  1. Guest

    I get the following error message

    C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:251:in
    `report_activate_error': Could not find RubyGem activerecord (>=
    0.0.0) (Gem::LoadError)
    from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:188:in
    `activate'
    from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:66:in
    `active_gem_with_options'
    from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:59:in
    `require_gem'
    from C:/RadRails/workspace/album/my_ruby_code.rb:1

    When I try execute the following piece of code

    require_gem "activerecord"

    class Photo < ActiveRecord::Base
    end

    Photo.establish_connection(
    :adapter => "mysql", :database => "album_development")

    for column in Photo.columns
    print column.name, "\t"
    end

    puts
    puts

    for photo in Photo.find:)all)
    for column in Photo.columns
    print photo.send(column.name), "\t"
    end
    puts
    end

    I suspect it's a class path problem or a bug in the version I am using
    which is the 1.8.4 stable version

    If anyone can help, i'd really appreciate it.

    Thanks
    , Jul 25, 2007
    #1
    1. Advertising

  2. Todd Benson Guest

    On 7/25/07, <> wrote:
    > I get the following error message
    >
    > C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:251:in
    > `report_activate_error': Could not find RubyGem activerecord (>=
    > 0.0.0) (Gem::LoadError)
    > from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:188:in
    > `activate'
    > from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:66:in
    > `active_gem_with_options'
    > from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:59:in
    > `require_gem'
    > from C:/RadRails/workspace/album/my_ruby_code.rb:1
    >
    > When I try execute the following piece of code
    >
    > require_gem "activerecord"


    Use: requre "active_record"

    Todd
    Todd Benson, Jul 25, 2007
    #2
    1. Advertising

  3. Guest

    On Jul 25, 1:26 pm, "Todd Benson" <> wrote:
    > On 7/25/07, <> wrote:
    >
    >
    >
    > > I get the following error message

    >
    > > C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:251:in
    > > `report_activate_error': Could not find RubyGem activerecord (>=
    > > 0.0.0) (Gem::LoadError)
    > > from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:188:in
    > > `activate'
    > > from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:66:in
    > > `active_gem_with_options'
    > > from C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:59:in
    > > `require_gem'
    > > from C:/RadRails/workspace/album/my_ruby_code.rb:1

    >
    > > When I try execute the following piece of code

    >
    > > require_gem "activerecord"

    >
    > Use: requre "active_record"
    >
    > Todd


    Thanks for the quick response

    I landed up running gem install activerecord --include dependencies
    and I got it to work but there was an error at the end

    Gem not found exception could not find dependencies. Do you know what
    this would mean?

    Also When i installed the Gem package - shouldn't it automatically
    install active record?
    , Jul 25, 2007
    #3
  4. Todd Benson Guest

    On 7/25/07, <> wrote:
    > On Jul 25, 1:26 pm, "Todd Benson" <> wrote:
    > > On 7/25/07, <> wrote:

    > Thanks for the quick response
    >
    > I landed up running gem install activerecord --include dependencies
    > and I got it to work but there was an error at the end
    >
    > Gem not found exception could not find dependencies. Do you know what
    > this would mean?
    >
    > Also When i installed the Gem package - shouldn't it automatically
    > install active record?


    I am not sure about your set up. Are you saying the command "gem
    install activerecord" worked fine, but you are having trouble
    requiring the gem in your code? Or are you saying that you can load
    the gem, but get an error when you try to use it. What is your OS?
    Are you requiring 'rubygems' first?

    Here's what I did...

    gem install activerecord

    Then, in irb...
    irb(main):001:0> require 'rubygems'
    => true
    irb(main):002:0> require 'postgres' #I require this because I'm using
    postgresql
    => true
    irb(main):003:0> require 'active_record'
    => true

    And then, smooth sailing from there on. Where in this process are you
    getting an error?
    Todd Benson, Jul 25, 2007
    #4
  5. Guest

    On Jul 25, 4:15 pm, "Todd Benson" <> wrote:
    > On 7/25/07, <> wrote:
    >
    > > On Jul 25, 1:26 pm, "Todd Benson" <> wrote:
    > > > On 7/25/07, <> wrote:

    > > Thanks for the quick response

    >
    > > I landed up running gem install activerecord --include dependencies
    > > and I got it to work but there was an error at the end

    >
    > > Gem not found exception could not find dependencies. Do you know what
    > > this would mean?

    >
    > > Also When i installed the Gem package - shouldn't it automatically
    > > install active record?

    >
    > I am not sure about your set up. Are you saying the command "gem
    > install activerecord" worked fine, but you are having trouble
    > requiring the gem in your code? Or are you saying that you can load
    > the gem, but get an error when you try to use it. What is your OS?
    > Are you requiring 'rubygems' first?
    >
    > Here's what I did...
    >
    > gem install activerecord
    >
    > Then, in irb...
    > irb(main):001:0> require 'rubygems'
    > => true
    > irb(main):002:0> require 'postgres' #I require this because I'm using
    > postgresql
    > => true
    > irb(main):003:0> require 'active_record'
    > => true
    >
    > And then, smooth sailing from there on. Where in this process are you
    > getting an error?


    Things seem to have gotten worse for me. I had it working at one point
    now i have installed everything from scratch again nad I get the
    following error - i am running windows

    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/
    vendor/mysql.rb:111:in `initialize': Bad file descriptor - connect(2)
    (Errno::EBADF)
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/vendor/mysql.rb:111:in `real_connect'
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/connection_adapters/mysql_adapter.rb:389:in `connect'
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/connection_adapters/mysql_adapter.rb:152:in `initialize'
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/connection_adapters/mysql_adapter.rb:82:in
    `mysql_connection'
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/connection_adapters/abstract/connection_specification.rb:
    262:in `connection_without_query_cache='
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/query_cache.rb:54:in `connection='
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/connection_adapters/abstract/connection_specification.rb:
    230:in `retrieve_connection'
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/connection_adapters/abstract/connection_specification.rb:
    78:in `connection'
    from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    active_record/base.rb:763:in `columns'
    from C:/RadRails/workspace/album/my_ruby_code.rb:9


    I installed ruby 1.8.4-20 into c:\ruby
    I then installed rails using gem insall rails -r -y
    I have the preference in RadRails set correctly to point to these
    directories but it seems as though it's looking for active record in a
    different directory or something

    Boy this sure is frustrating

    thanks
    jack
    , Jul 26, 2007
    #5
  6. Todd Benson Guest

    On 7/25/07, <> wrote:
    > Things seem to have gotten worse for me. I had it working at one point
    > now i have installed everything from scratch again nad I get the
    > following error - i am running windows
    >
    > C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/
    > vendor/mysql.rb:111:in `initialize': Bad file descriptor - connect(2)
    > (Errno::EBADF)
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/vendor/mysql.rb:111:in `real_connect'
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/connection_adapters/mysql_adapter.rb:389:in `connect'
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/connection_adapters/mysql_adapter.rb:152:in `initialize'
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/connection_adapters/mysql_adapter.rb:82:in
    > `mysql_connection'
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/connection_adapters/abstract/connection_specification.rb:
    > 262:in `connection_without_query_cache='
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/query_cache.rb:54:in `connection='
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/connection_adapters/abstract/connection_specification.rb:
    > 230:in `retrieve_connection'
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/connection_adapters/abstract/connection_specification.rb:
    > 78:in `connection'
    > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > active_record/base.rb:763:in `columns'
    > from C:/RadRails/workspace/album/my_ruby_code.rb:9
    >
    >
    > I installed ruby 1.8.4-20 into c:\ruby
    > I then installed rails using gem insall rails -r -y
    > I have the preference in RadRails set correctly to point to these
    > directories but it seems as though it's looking for active record in a
    > different directory or something


    No, this is a connection error. I can reproduce this by establishing
    a connection with 'mysql' (even though I don't have MySQL installed).
    Then, when I try to query through ActiveRecord, it gives me that
    error.

    Check
    - your database.yml file
    - that your mysql server is running
    Todd Benson, Jul 26, 2007
    #6
  7. Jacko Guest

    On Jul 26, 12:22 am, "Todd Benson" <> wrote:
    > On 7/25/07, <> wrote:
    >
    >
    >
    > > Things seem to have gotten worse for me. I had it working at one point
    > > now i have installed everything from scratch again nad I get the
    > > following error - i am running windows

    >
    > > C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/
    > > vendor/mysql.rb:111:in `initialize': Bad file descriptor - connect(2)
    > > (Errno::EBADF)
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/vendor/mysql.rb:111:in `real_connect'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/mysql_adapter.rb:389:in `connect'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/mysql_adapter.rb:152:in `initialize'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/mysql_adapter.rb:82:in
    > > `mysql_connection'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/abstract/connection_specification.rb:
    > > 262:in `connection_without_query_cache='
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/query_cache.rb:54:in `connection='
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/abstract/connection_specification.rb:
    > > 230:in `retrieve_connection'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/abstract/connection_specification.rb:
    > > 78:in `connection'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/base.rb:763:in `columns'
    > > from C:/RadRails/workspace/album/my_ruby_code.rb:9

    >
    > > I installed ruby 1.8.4-20 into c:\ruby
    > > I then installed rails using gem insall rails -r -y
    > > I have the preference in RadRails set correctly to point to these
    > > directories but it seems as though it's looking for active record in a
    > > different directory or something

    >
    > No, this is a connection error. I can reproduce this by establishing
    > a connection with 'mysql' (even though I don't have MySQL installed).
    > Then, when I try to query through ActiveRecord, it gives me that
    > error.
    >
    > Check
    > - your database.yml file
    > - that your mysql server is running


    that could be it, i will check that right away, thanks
    Jacko, Jul 26, 2007
    #7
  8. Jacko Guest

    On Jul 26, 12:22 am, "Todd Benson" <> wrote:
    > On 7/25/07, <> wrote:
    >
    >
    >
    > > Things seem to have gotten worse for me. I had it working at one point
    > > now i have installed everything from scratch again nad I get the
    > > following error - i am running windows

    >
    > > C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/
    > > vendor/mysql.rb:111:in `initialize': Bad file descriptor - connect(2)
    > > (Errno::EBADF)
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/vendor/mysql.rb:111:in `real_connect'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/mysql_adapter.rb:389:in `connect'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/mysql_adapter.rb:152:in `initialize'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/mysql_adapter.rb:82:in
    > > `mysql_connection'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/abstract/connection_specification.rb:
    > > 262:in `connection_without_query_cache='
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/query_cache.rb:54:in `connection='
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/abstract/connection_specification.rb:
    > > 230:in `retrieve_connection'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/connection_adapters/abstract/connection_specification.rb:
    > > 78:in `connection'
    > > from C:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
    > > active_record/base.rb:763:in `columns'
    > > from C:/RadRails/workspace/album/my_ruby_code.rb:9

    >
    > > I installed ruby 1.8.4-20 into c:\ruby
    > > I then installed rails using gem insall rails -r -y
    > > I have the preference in RadRails set correctly to point to these
    > > directories but it seems as though it's looking for active record in a
    > > different directory or something

    >
    > No, this is a connection error. I can reproduce this by establishing
    > a connection with 'mysql' (even though I don't have MySQL installed).
    > Then, when I try to query through ActiveRecord, it gives me that
    > error.
    >
    > Check
    > - your database.yml file
    > - that your mysql server is running


    I got it to work eventually, couple problems but the main thing is
    that i had to change the way you include the active record gem to as
    follows

    gem "activerecord"
    require "active_record"

    An earlier version of ruby may have worked with the require_gem
    "activerecord"

    thanks so much for your help, one of the problems i had was that I had
    not started the database so you were right.

    cheers
    jack (long night)
    Jacko, Jul 26, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. André
    Replies:
    0
    Views:
    3,730
    André
    Jun 25, 2006
  2. André
    Replies:
    0
    Views:
    434
    André
    Jun 25, 2006
  3. peashoe
    Replies:
    4
    Views:
    119
    peashoe
    Oct 11, 2006
  4. han
    Replies:
    1
    Views:
    117
    Lyle Johnson
    Oct 24, 2005
  5. Austin 7873
    Replies:
    5
    Views:
    179
    Eric Hodel
    Jan 27, 2007
Loading...

Share This Page