Re: Active Record not found



Jan Friedrich wrote:
activerecord != active_record ;)

To require gems you need also to require rubygems:

require 'rubygems'
require 'active_record'


So I guess I'm really confused then. This is my final code:

require 'net/http'
require 'active_record'

ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:username => 'root',
:password => '',
:database => 'app_development')

class Thing < ActiveRecord::Base
end

This works in IRB, and on the command line. I'm happy now, but still
wondering...

I didn't have to "require 'rubygems'" for this to work, why? Isn't
ActiveRecord a gem? And if so, shouldn't I have to use "gem
'active_record'" instead?

Also, if there wasn't an error on the _old_ line "require
'activerecord'" then ruby found something by that name ... what was it?

Finally, and this is where you can really help me: Where can I find
this info in the documentation. I've looked in the core reference, the
standard lib reference, and read the whole ActiveRecord section and
found nothing telling me how the _right_ way to include this was, what I
found was different people doing it different ways, none of which worked
for me.

--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • Re: gem & require -> returns false?
    ... Gem goes to load active_record and cannot find it, ... is an active_record file in a gem named 'activerecord'. ... again, but since the gem was activated with autorequire, the file is already ... (I've CC'ed the rubygems list to make sure everyone there sees this as well). ...
    (comp.lang.ruby)
  • Re: Trying (and failing) to load specific version of gem
    ... I have rubygems 1.0.1 installed. ... I have two gems of ActiveRecord installed ... gem 'activerecord', '=1.15.3' ... require 'gemconfigure' ...
    (comp.lang.ruby)
  • Re: question about mod_ruby, eruby and ajax
    ... >> Implements the ActiveRecord pattern for ORM. ... >> A plugin system based only on rubygems that uses dependencies only ... >> This package provides download sources for remote gem installation ... > form_remote_tag is from the ActionPack, To be able to use it you need ...
    (comp.lang.ruby)
  • Re: Railless ActiveRecord [Problem 2]
    ... require 'rubygems' ... there is always a bunch of warnings spat out by activerecord. ... Because gem() doesn't require anything. ...
    (comp.lang.ruby)
  • [ANN] RubyGems 1.1.0
    ... RubyGems now uses persistent connections on index updates. ... `gem spec` now extracts specifications from .gem files. ... Executable stubs now use ruby install name in shebang. ...
    (comp.lang.ruby)