Alex Polite
2006-Jul-06 09:28 UTC
[Rails] Can''t generate AR from script (ActiveRecord::ConnectionNotEstablished)
Generating ActiveRecord instances from the console works fine.
./script/console
Loading development environment.
>> Pim.new()
=> #<Pim:0xb74427dc @attributes={"vpimitem"=>nil},
@new_record=true>
>>
But running this little script:
#!/usr/bin/env ruby
require File.dirname(__FILE__) + ''/../config/boot''
Pim.new()
Will spit out this:
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:225:in
`retrieve_connection'': ActiveRecord::ConnectionNotEstablished
(ActiveRecord::ConnectionNotEstablished)
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in
`connection''
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:in
`columns''
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1969:in
`attributes_from_column_definition''
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1351:in
`initialize_without_callbacks''
from
/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/callbacks.rb:236:in
`initialize''
from playground/importer.rb:3
I''ve tried both sqlite and mysql as database adapters and get the same
error
in both cases.
--
Alex Polite
http://flosspick.org - finding the right open source
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060706/e779a3b8/attachment.html
Maybe Matching Threads
- App running fine on Webrick, ActiveRecord::ConnectionNotEstablished in lighttpd
- Flat file as storage backend or what ...
- how to solve ActiveRecord::ConnectionNotEstablished
- ConnectionNotEstablished when using connection on AR::Base abstract subclass
- ActiveRecord::ConnectionNotEstablished
