J
João Macaíba
Hi,
I'm using active_record and sqlite3-ruby (gem) modules. When I try to
connect to sqlite3 database, I get a error :
"MissingSourceFile: no such file to load -- sqlite3/database"
I have "sqlite3/database.rb" in my $: path as shown below.
Does anyone know what this means or what causes it ?
My environment is :
- ruby 1.8.7 (2008-08-08 patchlevel 71) [i686-linux]
- gem 1.2.0
[gems]
- activerecord (2.1.0)
- activesupport (2.1.0)
- sqlite3-ruby (1.2.2)
Thanks in advance for any help.
Below are shown the steps of how this error occurs and some information
about database and RUBYLIB.
--- snip ---
=> true
irb(main):002:0> require 'active_record'
=> true
irb(main):003:0> ActiveRecord::Base.establish_connection({:adapter =>
'sqlite3', :dbfile => '../../db/per.db'})
=> #<ActiveRecord::Base::ConnectionSpecification:0xb781bb60
@adapter_method="sqlite3_connection",
@config={:dbfile=>"../../db/per.db", :adapter=>"sqlite3"}>
irb(main):004:0> class Per_Configuration < ActiveRecord::Base
irb(main):005:1> end
=> nil
irb(main):006:0> pc = Per_Configuration.find(1)
MissingSourceFile: no such file to load -- sqlite3/database
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/lib/sqlite3.rb:1
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/requires.rb:7:in
`require_library_or_gem'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/reporting.rb:11:in
`silence_warnings'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/requires.rb:5:in
`require_library_or_gem'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:10:in
`sqlite3_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
`send'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
`connection='
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in
`retrieve_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
`connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2693:in
`quoted_table_name'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1371:in
`find_one'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1362:in
`find_from_ids'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:537:in
`find'
from (irb):6
from :0irb(main):007:0>
--- snip ---
--- snip ---
Enter ".help" for instructions
sqlite> select * from Per_Configurations;
1|Ports_Dir|/usr/per|text
2|Buffer_Repositories|buffer/repositories|text
sqlite>
--- snip ---
--- snip ---
irb(main):007:0> $:.each do |path|
irb(main):008:1* puts path
irb(main):009:1> end
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/tzinfo-0.3.8
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/memcache-client-1.5.0
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/xml-simple-1.0.11
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/builder-2.1.2
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib
/var/lib/gems/1.8/gems/sqlite3-ruby-1.2.2/lib
/home/macaiba/development/projects/per/lib
/lib
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/bin
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/bin
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/bin
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/lib
/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/i686-linux
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/vendor_ruby/1.8
/usr/local/lib/ruby/vendor_ruby/1.8/i686-linux
/usr/local/lib/ruby/vendor_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/i686-linux
I'm using active_record and sqlite3-ruby (gem) modules. When I try to
connect to sqlite3 database, I get a error :
"MissingSourceFile: no such file to load -- sqlite3/database"
I have "sqlite3/database.rb" in my $: path as shown below.
Does anyone know what this means or what causes it ?
My environment is :
- ruby 1.8.7 (2008-08-08 patchlevel 71) [i686-linux]
- gem 1.2.0
[gems]
- activerecord (2.1.0)
- activesupport (2.1.0)
- sqlite3-ruby (1.2.2)
Thanks in advance for any help.
Below are shown the steps of how this error occurs and some information
about database and RUBYLIB.
--- snip ---
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'active_record'
=> true
irb(main):003:0> ActiveRecord::Base.establish_connection({:adapter =>
'sqlite3', :dbfile => '../../db/per.db'})
=> #<ActiveRecord::Base::ConnectionSpecification:0xb781bb60
@adapter_method="sqlite3_connection",
@config={:dbfile=>"../../db/per.db", :adapter=>"sqlite3"}>
irb(main):004:0> class Per_Configuration < ActiveRecord::Base
irb(main):005:1> end
=> nil
irb(main):006:0> pc = Per_Configuration.find(1)
MissingSourceFile: no such file to load -- sqlite3/database
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/lib/sqlite3.rb:1
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in
`gem_original_require'
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
`new_constants_in'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
`require'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/requires.rb:7:in
`require_library_or_gem'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/reporting.rb:11:in
`silence_warnings'
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/kernel/requires.rb:5:in
`require_library_or_gem'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:10:in
`sqlite3_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
`send'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
`connection='
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in
`retrieve_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
`connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2693:in
`quoted_table_name'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1371:in
`find_one'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1362:in
`find_from_ids'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:537:in
`find'
from (irb):6
from :0irb(main):007:0>
--- snip ---
--- snip ---
SQLite version 3.4.2sqlite3 ../../db/per.db
Enter ".help" for instructions
sqlite> select * from Per_Configurations;
1|Ports_Dir|/usr/per|text
2|Buffer_Repositories|buffer/repositories|text
sqlite>
--- snip ---
--- snip ---
irb(main):007:0> $:.each do |path|
irb(main):008:1* puts path
irb(main):009:1> end
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/tzinfo-0.3.8
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/memcache-client-1.5.0
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/xml-simple-1.0.11
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/vendor/builder-2.1.2
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib
/var/lib/gems/1.8/gems/sqlite3-ruby-1.2.2/lib
/home/macaiba/development/projects/per/lib
/lib
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/bin
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/bin
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/bin
/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2/lib
/usr/local/lib/ruby/site_ruby/1.8
/usr/local/lib/ruby/site_ruby/1.8/i686-linux
/usr/local/lib/ruby/site_ruby
/usr/local/lib/ruby/vendor_ruby/1.8
/usr/local/lib/ruby/vendor_ruby/1.8/i686-linux
/usr/local/lib/ruby/vendor_ruby
/usr/local/lib/ruby/1.8
/usr/local/lib/ruby/1.8/i686-linux