Return to Snippet

Revision: 1542
at October 18, 2006 13:33 by andyh


Updated Code
# e.g. Copy existing data from users table to newly created members table
    userMove = User.find(:all)
    userMove.each do |t|
      Member.create  :first_name => t.forename,
                     :last_name => t.surname,
                     :email => t.email,
                     :password => t.password                   
    end

Revision: 1541
at October 18, 2006 13:20 by andyh


Initial Code
    # Copy existing data from users table to new members table
    userMove = User.find(:all)
    userMove.each do |t|
      Member.create  :first_name => t.first_name,
                     :last_name => t.last_name,
                     :nickname => t.nickname,
                     :email => t.email,
                     :hashed_password => t.hashed_password,
                     :group_id => t.group_id,
                     :active => 1,
                     :terms_of_service => 1,
                     :created_at => t.created_at,
                     :updated_at => t.updated_at
    end                    

Initial URL


Initial Description


Initial Title
Create data during migration

Initial Tags
data, rails, ruby

Initial Language
Ruby