Skip to content
aaronbee edited this page Sep 14, 2010 · 3 revisions

This page describes how to write scripts load data into the database.

When you are not in active record mode:
If a file db/loader.rb exists it will be run after the PIQL entities and Rails models have been loaded.
Here is a simple loader.rb example:

names = ["Alice", "Bob", "Calvin"]
names.each do |n|
  u = User.new
  u.name = n
  u.save($piql_env)
end

When you are in active record mode it loads the file db/ar_loader.rb instead.

Clone this wiki locally