rake
Quick and Dirty Guide to your 1st Rails app – Part #1

For all of you who want to take a peek at creating a Ruby on Rails application and need a quick start, this post is designed to aid you in getting to know RoR. I will post follow-ups to this to make this first application better and better and to incorporate more complex functionality in [...]

Share this on:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • Yahoo! Bookmarks
Read More
Posted on 3rd November 20092 Comments
Rails: Extracting fixtures from databases

With this simple rake task (put it in lib/tasks/extract_fixtures.rake) you can extract your data from an existing DB to prevent overwriting of data when using rake db:fixtures:load:
desc ‘Create YAML test fixtures from data in an existing database.’
task :extract_fixtures => :environment do
  sql = “SELECT * FROM %s”
  skip_tables = ["schema_info"]
  ActiveRecord::Base.establish_connection
  (ActiveRecord::Base.connection.tables – skip_tables).each do
|table_name|
    [...]

Share this on:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • email
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • Yahoo! Bookmarks
Read More
Posted on 30th October 2009No Comments