rails runner script/load_orders.rb

I'm going through Agile Web Development with Rails (3.1) and following their demo.

here is
Download rails31/depot/script/load_orders.rb

Order.transaction do
  (1..100).each do |i|
    Order.create(:name => "Customer #{i}", :address => "#{i} Main Street",
        :email => "customer-#{i}@example.com", :pay_type => "Check")
    end
end

Server is running and demo app is working. If I do Tools | Run Rails Script and select script/load_orders.rb I get the following error:
uninitialized constant Object::Order (NameError)

Order is a table defined in demo with records in it.


Looking on the web I find other blogs that in earlier versions of rails there were

script/console and
script/runner commands.

Could I get some guidance about how to do this correctly in RM?

2 comments
Comment actions Permalink

I am curious if you ever figured out how to do this in RubyMine? It obviously works to run "rails runner script/load_orders.rb" from the console..

thanks,
Murat

0
Comment actions Permalink

Murat,
Thanks for getting back to me. Actually I can't remember the problem I had 8 months ago.
I had some other and later problems with implementing the mercury plugin which destroyed a rakefile script.
I could not get past that problem and the best information at the time I could get was that all versions
of ruby and rails needed to be purged from my system and reloaded.

At that point I stopped trying. I never tried to start over. I haven't written any rails apps or used RM since
then.

Robin

0

Please sign in to leave a comment.