Forum: Ruby on Rails loading data with migrations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6661ef9d747db3af8896cd94959d717d?d=identicon&s=25 Paul Barry (Guest)
on 2006-04-04 19:50
(Received via mailing list)
Hello,

I'm just taking a look at migrations, seems like a fantastic way to
maintain
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
using
migrations?
6661ef9d747db3af8896cd94959d717d?d=identicon&s=25 Paul Barry (Guest)
on 2006-04-04 19: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
      end

      SystemSetting.create :name => "notice", :label => "Use notice?",
:value => 1
    end
E025e426244a038645a4a08ba1a2d97f?d=identicon&s=25 Anthony Moralez (Guest)
on 2006-04-04 19:57
(Received via mailing list)
http://wiki.rubyonrails.com/rails/pages/Understand...

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

Anthony
This topic is locked and can not be replied to.