Forum: Ruby on Rails loading data with migrations

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Paul B. (Guest)
on 2006-04-04 21:50
(Received via mailing list)

I'm just taking a look at migrations, seems like a fantastic way to
the database.  I am wonder if there is a way to maintain what I'll call
"reference data" along with the migrations.  A lot of times in apps your
have tables that have pretty static data, often used to generate select
lists.  Is there a way to insert the reference data into these tables
Paul B. (Guest)
on 2006-04-04 21:53
(Received via mailing list)
Nevermind, RTFM

  class AddSystemSettings < ActiveRecord::Migration
    def self.up
      create_table :system_settings do |t|
        t.column :name,     :string
        t.column :label,    :string
        t.column :value,    :text
        t.column :type,     :string
        t.column :position, :integer

      SystemSetting.create :name => "notice", :label => "Use notice?",
:value => 1
Anthony Moralez (Guest)
on 2006-04-04 21:57
(Received via mailing list)

About three quarters of the way down that page is a brief mention of
adding look up data from a migration.

This topic is locked and can not be replied to.