public
Clone URL: git://github.com/robbyrussell/rubyurl.git
Search Repo:
adding migration script

git-svn-id: https://svn.roundhaus.com/planetargon/rubyurl_2-0/trunk@60 
f0bc2f90-cf15-dc11-b192-0016e6374d05
robbyrussell (author)
Tue Aug 07 15:18:50 -0700 2007
commit  c1e2a7ee1cf6b64fc3314f0c9356db56bb5e97a7
tree    ef7f0eed059121f8c8f7504e39b70c5248af2497
parent  f80ae998b476bc7f659ff4f737f5e5c2dc01f67c
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
0
@@ -1 +1,25 @@
0
+#!/usr/bin/ruby
0
+require File.dirname(__FILE__) + '/../config/environment'
0
+
0
+class Rubyurl < ActiveRecord::Base
0
+end
0
+
0
+@old_links = Rubyurl.find(:all)
0
+
0
+@count = 0
0
+
0
+@old_links.each do |old_link|
0
+ # create new link
0
+
0
+ @link = Link.find_or_create_by_website_url( old_link.website_url )
0
+ @link.ip_address = '0.0.0.0'
0
+
0
+ if @link.save
0
+ @count += 1
0
+ puts "saved ##{@count}"
0
+ else
0
+ puts @link.errors.to_yaml
0
+ puts "unable to save #{@link.website_url}"
0
+ end
0
+end

Comments

    No one has commented yet.