Rails Command Line Script

Hi,
I am trying to run a command line Rails script. This worked wonderfully,
until I upgraded to Rails 1.4. I do the following:

#!/usr/bin/env ruby
require File.dirname(FILE) + ‘/…/config/environment’

ActiveRecord::Base.establish_connection
(ActiveRecord::Base.configurations[“development”])

user = User.find(uid)

and I get the following error, please help:

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_suppo
rt/dependencies.rb:123:in const_missing': uninitialized constant ApplicationCon troller (NameError) from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib /active_support/dependencies.rb:131:inconst_missing’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib
/active_support/dependencies.rb:133:in send' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib /active_support/dependencies.rb:133:inconst_missing’
from ./…/config/…/app/models/blog.rb:26
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib
/active_support/dependencies.rb:140:in load' from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib /active_support/dependencies.rb:140:inload’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib
/active_support/dependencies.rb:56:in `require_or_load’
from
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib

On 10/22/06, Vinod K. [email protected] wrote:

Hi,
I am trying to run a command line Rails script. This worked wonderfully,
until I upgraded to Rails 1.4. I do the following:

Are you opening your console Window through Instant Rails or otherwise
ensuring that the IR 1.4 ruby\bin directory is on your path before any
other instance of Ruby?

I can report that it is working for me, so there is something not
quite right with your environment.

Curt

Curt H. wrote:

On 10/22/06, Vinod K. [email protected] wrote:

Hi,
I am trying to run a command line Rails script. This worked wonderfully,
until I upgraded to Rails 1.4. I do the following:

Are you opening your console Window through Instant Rails or otherwise
ensuring that the IR 1.4 ruby\bin directory is on your path before any
other instance of Ruby?

I can report that it is working for me, so there is something not
quite right with your environment.

Curt

It somehow seems like I am not able to load the ApplicationController. I
removed all the logic that was being referred in the application.rb and
put it in a helper, and now it works fine. I am opening my script
through windows, but I am running use_ruby to ensure that all the
environment variables are loaded.