I’m new to ruby, so I may have this all wrong. I’m trying to use
activerecord to manage database functions for a small script I’m
writing. I’ve installed the activerecord gem, and verified it’s in the
list of local gems.
What happens if you replace “gem ‘activerecord’” with “require
Upon changing I receive this error:
C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require': no such file to load -- activerecord (LoadError) from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
Which to my eyes appears that activerecord may not be installed.
HOWEVER I tried this:
and it seems to work, until:
C:\InstantRails\ruby\lib\ruby\gems\1.8\gems\activesupport-1.4.2\lib/active_support/dependencies.rb:376:in new_constants_in': undefined methodempty?’ for nil:NilClass
C:\InstantRails\ruby\lib\ruby\gems\1.8\gems\activesupport-1.4.2\lib/active_support/dependencies.rb:495:in require' from C:\InstantRails\ruby\lib\ruby\gems\1.8\gems\activesupport-1.4.2\lib/active_support.rb:34 from C:\InstantRails\ruby\lib\ruby\gems\1.8\gems\activerecord-1.15.3\lib/active_record.rb:30:inrequire’
from app/gatherer.rb:2:in `require’
This works in IRB, and on the command line. I’m happy now, but still
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
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