Best Practice:: Filling Models With Data

Use a Rake task.

In Lib/tasks, make this file

import.rake

In that file, put this code:

namespace :db do

desc “Boostrap my database with default data”
task :import => :environment do

User.create :login => "admin", :password=>"admin", :password_confirmation=>"admin", email=>"admin@yourdomain.com"

other cool ruby code goes here

end

end

Then, as part of your deployment,

rake RAILS_ENV=“production” db:import

(make that part of your deployment recipe if you wish!)

Hope that helps!