ActiveRecord / SQL Server / ADO

I’m trying to use ActiveRecord with SQL Server and ADO in a regular ruby
script, but can’t get it working. I’ve seen a bunch of examples but
can’t get them to work.

Here’s what I’ve got:

require ‘rubygems’
require ‘active_record’

class TestMO < ActiveRecord::Base

ActiveRecord::Base.establish_connection(
    :adapter  => "sqlserver",
    :mode =>  "ado",
    :database =>  "mydb",
    :username =>  "user",
    :password =>  "pass"
)

set_table_name "test_mo"

end

I’ve got the ADO.rb in the right place I believe.

Here’s the error I’m getting:

custom_require.rb:27:in `gem_original_require’: no such file to load

On Oct 26, 2:59 pm, Jayson B. [email protected] wrote:

I’ve got the ADO.rb in the right place I believe.

Here’s the error I’m getting:

custom_require.rb:27:in `gem_original_require’: no such file to load

Posted viahttp://www.ruby-forum.com/.

I believe you need to use ‘gem’ or ‘require_gem’ for active_record.

[email protected] wrote:

I believe you need to use ‘gem’ or ‘require_gem’ for active_record.

No, gem only sets the version of a later required gem and require_gem is
deprecated.

irb(main):001:0> require “rubygems”
=> true
irb(main):002:0> require “active_record”
=> true

On Oct 26, 2:59 pm, Jayson B. [email protected] wrote:

I’ve got the ADO.rb in the right place I believe.

Here’s the error I’m getting:

custom_require.rb:27:in `gem_original_require’: no such file to load

Posted viahttp://www.ruby-forum.com/.

I believe you need to use ‘gem’ or ‘require_gem’ for active_record.

Jayson B. wrote:

I’m trying to use ActiveRecord with SQL Server and ADO in a regular ruby
script, but can’t get it working. I’ve seen a bunch of examples but
can’t get them to work.

Here’s what I’ve got:

require ‘rubygems’
require ‘active_record’

Here’s the error I’m getting:

custom_require.rb:27:in `gem_original_require’: no such file to load

Is this the exact line?

I got

irb(main):003:0> require “some”
MissingSourceFile: no such file to load – some
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’

Which version of rubygems are you using?