ActiveRecordConnection from jobs script

0 views
Skip to first unread message

Greg Ma

unread,
Jun 15, 2010, 4:07:29 PM6/15/10
to rubyonra...@googlegroups.com
Hi,
I make a cron jobs and I would like to use ActiveRecord. but I have this
error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection': ActiveRecord::ConnectionNotEstablished
(ActiveRecord::ConnectionNotEstablished)

Do I have to require something else?

This is what I am already requiring:
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'ostruct'
require 'active_record'

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

Marnen Laibow-Koser

unread,
Jun 15, 2010, 5:20:43 PM6/15/10
to rubyonra...@googlegroups.com

I believe you should be using script/runner.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

Ivan Nastyukhin

unread,
Jun 15, 2010, 5:28:13 PM6/15/10
to rubyonra...@googlegroups.com
or thome think like this: ActiveRecord::Base.establish_connection
Ivan Nastyukhin
diei...@me.com

> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

Reply all
Reply to author
Forward
0 new messages