Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ChangeNameToFirstAndLast < ActiveRecord::Migration
- def up
- add_column 'moviegoers', 'first_name', :string
- add_column 'moviegoers', 'last_name', :string
- Moviegoer.all.each do |m|
- m.update_attributes(:first => $1, :last => $2) if
- m.name =~ /^(.*)\s+(.*)$/
- end
- remove_column 'moviegoers', 'name'
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement