jeroen
1
Hi,
I’m looking to create a ruby script that loads a bunch of records and
manipulates these. Where do I start?
I got this to begin with:
#!/usr/bin/env ruby
require File.dirname(FILE) + ‘/…/config/boot’
players = Player.find :all
But it complains about a DB connection. How do I set this up?
Jeroen
jeroen
2
#!/usr/bin/env ruby
require File.dirname(FILE) + ‘/…/config/boot’
require File.dirname(FILE) + ‘/…/config/environment’
ActiveRecord::Base.establish_connection
(ActiveRecord::Base.configurations[“development”])
user = User.find(:first)
puts user.to_yaml
Warren
On 01-Feb-06, at 2:34 PM, Jeroen H. wrote:
But it complains about a DB connection. How do I set this up?
Jeroen
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Best Regards,
Warren N…
GNU (http://www.gnu.org.in)
jeroen
3
#!/usr/bin/env ruby
require File.dirname(FILE) + ‘/…/config/boot’
require File.dirname(FILE) + ‘/…/config/environment’
ActiveRecord::Base.establish_connection
(ActiveRecord::Base.configurations[“development”])
user = User.find(:first)
puts user.to_yaml
Warren
On 01-Feb-06, at 2:34 PM, Jeroen H. wrote:
But it complains about a DB connection. How do I set this up?
Jeroen
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Best Regards,
Warren N…
GNU (http://www.gnu.org.in)
jeroen
4
Jeroen H. wrote:
Hi,
I’m looking to create a ruby script that loads a bunch of records and
manipulates these. Where do I start?
script/runner your_script_here.rb
jeroen
5
Alex Y. wrote:
Jeroen H. wrote:
Hi,
I’m looking to create a ruby script that loads a bunch of records and
manipulates these. Where do I start?
script/runner your_script_here.rb
It doesn’t seem to take a file as an argument, just a string…
Jeroen
jeroen
6
Jeroen H. wrote:
It doesn’t seem to take a file as an argument, just a string…
… Ok…
script/runner ‘require “your_script_here”’
jeroen
7
Alex Y. wrote:
It doesn’t seem to take a file as an argument, just a string…
… Ok…
script/runner ‘require “your_script_here”’
Why didn’t I think of that?? Anyway, thanks for you help, this works
perfectly!
Jeroen