Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require_gem 'activerecord'
- class BooksToDo < ActiveRecord::Base
- set_table_name "books"
- end
- class UsersInfo < ActiveRecord::Base
- set_table_name "users"
- end
- # This gets my database config
- @dbs = YAML::load(ERB.new(IO.read("/home/myname/config/database.yml")).result)
- # to slurp records into production db, change this line to production.
- curr_db = @dbs["development"]
- # these parameters are mysql-specific, figure out how to improve
- ActiveRecord::Base.establish_connection(:adapter => curr_db["adapter"], :database => curr_db["database"],:host => curr_db["host"], :username => curr_db["username"], :password => curr_db["password"])
- generate = BooksToDo.find(:all, :conditions => "status=0")
- for book in generate
- # do whatever
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement