connections 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Connections
1
+ # Connections [![Build Status](https://secure.travis-ci.org/balvig/connections.png?branch=master)](http://travis-ci.org/balvig/connections)
2
2
 
3
3
  Most social apps need some kind of follow/like/watch/stalk/etc
4
4
  features that connects one model to another.
@@ -7,8 +7,6 @@ Instead of having to recreate this functionality for every project I
7
7
  decided to create a gem that easily allows you to add these features
8
8
  using any naming you prefer.
9
9
 
10
- [![Build Status](https://secure.travis-ci.org/balvig/connections.png?branch=master)](http://travis-ci.org/balvig/connections)
11
-
12
10
  ## Installation
13
11
 
14
12
  Add the gem to the gemfile:
@@ -26,42 +24,52 @@ Use `connects_with` to enable a model to connect to other models and
26
24
  `connectable_with ` to allow a model to be connected to using
27
25
  whatever naming scheme you prefer (follow, like, watch, etc)
28
26
 
29
- class User < ActiveRecord::Base
30
- connects_with :follow, :like
31
- connectable_with :follow
32
- end
27
+ ```ruby
28
+ class User < ActiveRecord::Base
29
+ connects_with :follow, :like
30
+ connectable_with :follow
31
+ end
33
32
 
34
- class Post < ActiveRecord::Base
35
- connectable_with :like
36
- end
33
+ class Post < ActiveRecord::Base
34
+ connectable_with :like
35
+ end
36
+ ```
37
37
 
38
38
  Depending on the naming scheme you choose Connections will try to figure out the
39
39
  grammar and add appropriately named methods. For example in the case of
40
40
  "Follow" and "Like" the following methods will be added:
41
41
 
42
- # Follow
43
- user.follow(other_user) # Creates a 'Follow' connection from user -> other_user
44
- user.unfollow(other_user) # Removes 'Follow' connection between user -> other_user
45
- user.toggle_follow(other_user) # Toggles the connection on/off (useful for toggle buttons)
46
- user.follows?(other_user) # Returns true if the user if following other_user
47
- user.following(:user) # Returns a list of all the users the user is following
48
- other_user.followers(:user) #Returns a list of all the user's followers
49
-
50
- # Like
51
- user.like(post)
52
- user.unlike(post)
53
- user.toggle_like(post)
54
- user.likes?(post)
55
- user.liking(:post)
56
- post.likers(:user)
42
+ ```ruby
43
+ # Follow
44
+ user.follow(other_user) # Creates a 'Follow' connection from user -> other_user
45
+ user.unfollow(other_user) # Removes 'Follow' connection between user -> other_user
46
+ user.toggle_follow(other_user) # Toggles the connection on/off (useful for toggle buttons)
47
+ user.follows?(other_user) # Returns true if the user if following other_user
48
+ user.following(:user) # Returns a list of all the users the user is following
49
+ user.following.size # Returns a total count of followers of the user
50
+ other_user.followers(:user) #Returns a list of all the user's followers who are class 'User'
51
+ other_user.followers.size #Returns a total count of all the user's followers
52
+
53
+ # Like
54
+ user.like(post)
55
+ user.unlike(post)
56
+ user.toggle_like(post)
57
+ user.likes?(post)
58
+ user.liking(:post)
59
+ post.liking.size
60
+ post.likers(:user)
61
+ post.likers.size
62
+ ```
57
63
 
58
64
  That's it! If you want to add extra functionality to the join model (such
59
65
  as using callbacks etc) you can explicitly define the model in your
60
66
  project like this:
61
67
 
62
- class Follow < Connections::Connection
63
- ...
64
- end
68
+ ```ruby
69
+ class Follow < Connections::Connection
70
+ ...
71
+ end
72
+ ```
65
73
 
66
74
  ## Credits
67
75
 
@@ -9,9 +9,13 @@ module Connections
9
9
  class_eval do
10
10
 
11
11
  # user.followers(:user)
12
- define_method :"#{t.to_s.sub(/e$/,'')}ers" do |class_name|
13
- klass = class_name.to_s.classify.constantize
14
- klass.joins(:connections).where("connections_connections.type = ? AND connectable_type = ? AND connectable_id = ?", t.to_s.classify, self.class.base_class.to_s, self)
12
+ define_method :"#{t.to_s.sub(/e$/,'')}ers" do |class_name = nil|
13
+ if class_name
14
+ klass = class_name.to_s.classify.constantize
15
+ klass.joins(:connections).where("connections_connections.type = ? AND connectable_type = ? AND connectable_id = ?", t.to_s.classify, self.class.base_class.to_s, self)
16
+ else
17
+ incoming_connections.where('connections_connections.type = ?', t.to_s.classify)
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -13,8 +13,7 @@ module Connections
13
13
 
14
14
  # user.follow(other_user)
15
15
  define_method t do |connectable|
16
- klass = Object.const_defined?(t.to_s.classify) ? t.to_s.classify.constantize : Connections::Connection
17
- klass.create do |c|
16
+ Connections::Connection.create do |c|
18
17
  c.type = t.to_s.classify
19
18
  c.connector = self
20
19
  c.connectable = connectable
@@ -42,10 +41,15 @@ module Connections
42
41
  end
43
42
 
44
43
  # user.following(:user)
45
- define_method :"#{t.to_s.sub(/e$/,'')}ing" do |class_name|
46
- klass = class_name.to_s.classify.constantize
47
- klass.joins(:incoming_connections).where("connections_connections.type = ? AND connector_type = ? AND connector_id = ?", t.to_s.classify, self.class.base_class.to_s, self)
44
+ define_method :"#{t.to_s.sub(/e$/,'')}ing" do |class_name = nil|
45
+ if class_name
46
+ klass = class_name.to_s.classify.constantize
47
+ klass.joins(:incoming_connections).where("connections_connections.type = ? AND connector_type = ? AND connector_id = ?", t.to_s.classify, self.class.base_class.to_s, self)
48
+ else
49
+ connections.where('connections_connections.type = ?', t.to_s.classify)
50
+ end
48
51
  end
52
+
49
53
  end
50
54
  end
51
55
  end
@@ -1,3 +1,3 @@
1
1
  module Connections
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -29,25 +29,32 @@ class ConnectionsTest < ActiveSupport::TestCase
29
29
  assert !@follower.follows?(@user)
30
30
  end
31
31
 
32
- test '#following' do
32
+ test '#following with arg' do
33
33
  @follower.follow(@user)
34
34
  @follower.follow(@post)
35
35
  assert_equal [@user], @follower.following(:user)
36
36
  assert_equal [@post], @follower.following(:post)
37
37
  end
38
38
 
39
- test '#follows' do
40
- #TODO: What should happen if the Follow model isn't defined?
41
- #assert !@user.respond_to?(:follows)
39
+ test '#following without arg' do
40
+ @follower.follow(@user)
41
+ @follower.follow(@post)
42
+ assert_equal 2, @follower.following.size
42
43
  end
43
44
 
44
- test '#followers' do
45
+ test '#followers with arg' do
45
46
  @follower.follow(@user)
46
47
  @follower.follow(@post)
47
48
  assert_equal [@follower], @user.followers(:user)
48
49
  assert_equal [@follower], @post.followers(:user)
49
50
  end
50
51
 
52
+ test '#followers without arg' do
53
+ @follower.follow(@post)
54
+ @user.follow(@post)
55
+ assert_equal 2, @post.followers.size
56
+ end
57
+
51
58
  # Explicit Like class defined
52
59
  test '#like' do
53
60
  assert !@user.likes?(@post)
@@ -78,4 +85,5 @@ class ConnectionsTest < ActiveSupport::TestCase
78
85
  @user.like(@post)
79
86
  assert_equal [@post], @user.likes.map(&:connectable)
80
87
  end
88
+
81
89
  end
Binary file
Binary file
@@ -1,342 +1,27 @@
1
-  (0.2ms) select sqlite_version(*)
2
-  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
3
-  (0.0ms) PRAGMA index_list("schema_migrations")
4
-  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
6
- Migrating to CreateConnectionsConnections (20120311000457)
7
-  (0.0ms) begin transaction
8
-  (0.4ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connecter_id" integer, "connectable_id" integer, "connecter_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
9
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120311000457')
10
-  (1.0ms) commit transaction
11
-  (0.1ms) select sqlite_version(*)
12
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
13
-  (0.0ms) PRAGMA index_list("connections_connections")
14
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
15
- Migrating to CreateUsers (20120307051243)
16
-  (0.1ms) select sqlite_version(*)
17
-  (0.0ms) begin transaction
18
-  (0.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
19
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051243')
20
-  (2.4ms) commit transaction
21
- Migrating to CreatePosts (20120307051308)
22
-  (0.0ms) begin transaction
23
-  (0.3ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
24
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051308')
25
-  (0.9ms) commit transaction
26
-  (0.0ms) select sqlite_version(*)
27
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
28
-  (0.0ms) PRAGMA index_list("connections_connections")
29
-  (0.0ms) PRAGMA index_list("posts")
30
-  (0.0ms) PRAGMA index_list("users")
31
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
32
- Migrating to CreateUsers (20120307051243)
33
- Migrating to CreatePosts (20120307051308)
34
- Migrating to CreateConnectionsConnections (20120311000457)
35
-  (0.1ms) select sqlite_version(*)
36
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
37
-  (0.0ms) PRAGMA index_list("connections_connections")
38
-  (0.0ms) PRAGMA index_list("posts")
39
-  (0.0ms) PRAGMA index_list("users")
40
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
41
- Migrating to CreateUsers (20120307051243)
42
- Migrating to CreatePosts (20120307051308)
43
-  (0.1ms) select sqlite_version(*)
44
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
45
-  (0.0ms) PRAGMA index_list("connections_connections")
46
-  (0.0ms) PRAGMA index_list("posts")
47
-  (0.0ms) PRAGMA index_list("users")
48
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
49
-  (0.1ms) select sqlite_version(*)
50
-  (1.3ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connecter_id" integer, "connectable_id" integer, "connecter_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
51
-  (0.9ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
52
-  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
53
-  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
54
-  (0.0ms) PRAGMA index_list("schema_migrations")
55
-  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
56
-  (0.1ms) SELECT version FROM "schema_migrations"
57
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120311000457')
58
-  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
59
-  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')
60
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
61
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
62
- Migrating to CreateConnectionsConnections (20120311000457)
63
-  (0.0ms) select sqlite_version(*)
64
-  (0.0ms) begin transaction
65
-  (0.5ms) DROP TABLE "connections_connections"
66
-  (0.1ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = '20120311000457'
67
-  (0.7ms) commit transaction
68
-  (0.1ms) select sqlite_version(*)
69
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
70
-  (0.0ms) PRAGMA index_list("posts")
71
-  (0.0ms) PRAGMA index_list("users")
72
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
73
- Migrating to CreateUsers (20120307051243)
74
- Migrating to CreatePosts (20120307051308)
75
- Migrating to CreateConnectionsConnections (20120311000457)
76
-  (0.0ms) begin transaction
77
-  (0.4ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
78
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120311000457')
79
-  (1.0ms) commit transaction
80
-  (0.0ms) select sqlite_version(*)
81
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
82
-  (0.0ms) PRAGMA index_list("connections_connections")
83
-  (0.0ms) PRAGMA index_list("posts")
84
-  (0.0ms) PRAGMA index_list("users")
85
-  (0.6ms) select sqlite_version(*)
86
-  (2.3ms) DROP TABLE "connections_connections"
87
-  (0.9ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
88
-  (1.6ms) DROP TABLE "posts"
89
-  (1.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
90
-  (1.5ms) DROP TABLE "users"
91
-  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
92
-  (0.6ms) SELECT version FROM "schema_migrations"
93
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
94
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
95
- Migrating to CreateUsers (20120307051243)
96
- Migrating to CreatePosts (20120307051308)
97
- Migrating to CreateConnectionsConnections (20120311000457)
98
-  (0.1ms) select sqlite_version(*)
99
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
100
-  (0.0ms) PRAGMA index_list("connections_connections")
101
-  (0.0ms) PRAGMA index_list("posts")
102
-  (0.0ms) PRAGMA index_list("users")
103
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
104
- Migrating to CreateUsers (20120307051243)
105
- Migrating to CreatePosts (20120307051308)
106
- Migrating to CreateConnectionsConnections (20120311000457)
107
-  (0.1ms) select sqlite_version(*)
108
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
109
-  (0.0ms) PRAGMA index_list("connections_connections")
110
-  (0.0ms) PRAGMA index_list("posts")
111
-  (0.0ms) PRAGMA index_list("users")
112
-
113
-
114
- Started GET "/" for 127.0.0.1 at Sat Mar 10 20:25:05 -0800 2012
115
-
116
- ActionController::RoutingError (No route matches [GET] "/"):
117
- actionpack (3.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
118
- actionpack (3.2.2) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
119
- railties (3.2.2) lib/rails/rack/logger.rb:26:in `call_app'
120
- railties (3.2.2) lib/rails/rack/logger.rb:16:in `call'
121
- actionpack (3.2.2) lib/action_dispatch/middleware/request_id.rb:22:in `call'
122
- rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
123
- rack (1.4.1) lib/rack/runtime.rb:17:in `call'
124
- activesupport (3.2.2) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
125
- rack (1.4.1) lib/rack/lock.rb:15:in `call'
126
- actionpack (3.2.2) lib/action_dispatch/middleware/static.rb:61:in `call'
127
- railties (3.2.2) lib/rails/engine.rb:479:in `call'
128
- railties (3.2.2) lib/rails/application.rb:220:in `call'
129
- rack (1.4.1) lib/rack/content_length.rb:14:in `call'
130
- railties (3.2.2) lib/rails/rack/log_tailer.rb:14:in `call'
131
- rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
132
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
133
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
134
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
135
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:162:in `start'
136
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
137
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:95:in `start'
138
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:92:in `each'
139
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:92:in `start'
140
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:23:in `start'
141
- /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/1.8/webrick/server.rb:82:in `start'
142
- rack (1.4.1) lib/rack/handler/webrick.rb:13:in `run'
143
- rack (1.4.1) lib/rack/server.rb:265:in `start'
144
- railties (3.2.2) lib/rails/commands/server.rb:70:in `start'
145
- railties (3.2.2) lib/rails/commands.rb:55
146
- railties (3.2.2) lib/rails/commands.rb:50:in `tap'
147
- railties (3.2.2) lib/rails/commands.rb:50
148
- script/rails:6:in `require'
149
- script/rails:6
150
-
151
-
152
- Rendered /Users/jens/.rbenv/versions/ree-1.8.7-2010.02/lib/ruby/gems/1.8/gems/actionpack-3.2.2/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.0ms)
153
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
154
- Migrating to CreateUsers (20120307051243)
155
- Migrating to CreatePosts (20120307051308)
156
-  (0.1ms) select sqlite_version(*)
157
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
158
-  (0.0ms) PRAGMA index_list("connections_connections")
159
-  (0.0ms) PRAGMA index_list("posts")
160
-  (0.0ms) PRAGMA index_list("users")
161
-  (0.5ms) select sqlite_version(*)
162
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
163
-  (0.0ms) PRAGMA index_list("connections_connections")
164
-  (0.0ms) PRAGMA index_list("posts")
165
-  (0.0ms) PRAGMA index_list("users")
166
-  (0.5ms) select sqlite_version(*)
167
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
168
-  (0.0ms) PRAGMA index_list("connections_connections")
169
-  (0.0ms) PRAGMA index_list("posts")
170
-  (0.0ms) PRAGMA index_list("users")
171
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
172
- Migrating to CreateUsers (20120307051243)
173
- Migrating to CreatePosts (20120307051308)
174
- Migrating to CreateConnectionsConnections (20120311000457)
175
-  (0.0ms) select sqlite_version(*)
176
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
177
-  (0.1ms) PRAGMA index_list("connections_connections")
178
-  (0.0ms) PRAGMA index_list("posts")
179
-  (0.0ms) PRAGMA index_list("users")
180
-  (0.1ms) select sqlite_version(*)
181
-  (2.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
182
-  (0.0ms) PRAGMA index_list("schema_migrations")
183
-  (1.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
184
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
185
- Migrating to CreateUsers (20120307051243)
186
-  (0.0ms) begin transaction
187
-  (0.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
188
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051243')
189
-  (0.7ms) commit transaction
190
- Migrating to CreatePosts (20120307051308)
191
-  (0.0ms) begin transaction
192
-  (0.4ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
193
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051308')
194
-  (0.8ms) commit transaction
195
- Migrating to CreateConnectionsConnections (20120311000457)
196
-  (0.0ms) begin transaction
197
-  (0.4ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
198
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120311000457')
199
-  (0.7ms) commit transaction
200
-  (0.1ms) select sqlite_version(*)
201
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
202
-  (0.0ms) PRAGMA index_list("connections_connections")
203
-  (0.0ms) PRAGMA index_list("posts")
204
-  (0.0ms) PRAGMA index_list("users")
205
-  (0.6ms) select sqlite_version(*)
206
-  (2.7ms) DROP TABLE "connections_connections"
207
-  (1.1ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
208
-  (1.1ms) DROP TABLE "posts"
209
-  (1.0ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
210
-  (1.1ms) DROP TABLE "users"
211
-  (1.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
212
-  (0.2ms) SELECT version FROM "schema_migrations"
213
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
214
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
215
- Migrating to CreateUsers (20120307051243)
216
- Migrating to CreatePosts (20120307051308)
217
- Migrating to CreateConnectionsConnections (20120311000457)
218
-  (0.1ms) select sqlite_version(*)
219
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
220
-  (0.0ms) PRAGMA index_list("connections_connections")
221
-  (0.0ms) PRAGMA index_list("posts")
222
-  (0.0ms) PRAGMA index_list("users")
223
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
224
- Migrating to CreateUsers (20120307051243)
225
- Migrating to CreatePosts (20120307051308)
226
- Migrating to CreateConnectionsConnections (20120311045747)
227
-  (0.0ms) select sqlite_version(*)
228
-  (0.0ms) begin transaction
229
-  (0.1ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
230
- SQLite3::SQLException: table "connections_connections" already exists: CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
231
-  (0.0ms) rollback transaction
232
-  (0.1ms) select sqlite_version(*)
233
-  (2.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
234
-  (0.0ms) PRAGMA index_list("schema_migrations")
235
-  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
236
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
237
- Migrating to CreateUsers (20120307051243)
238
-  (0.0ms) begin transaction
239
-  (0.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
240
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051243')
241
-  (1.0ms) commit transaction
242
- Migrating to CreatePosts (20120307051308)
243
-  (0.0ms) begin transaction
244
-  (0.3ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
245
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051308')
246
-  (0.9ms) commit transaction
247
- Migrating to CreateConnectionsConnections (20120311045747)
248
-  (0.0ms) begin transaction
249
-  (0.3ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
250
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120311045747')
251
-  (1.1ms) commit transaction
252
-  (0.1ms) select sqlite_version(*)
253
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
254
-  (0.0ms) PRAGMA index_list("connections_connections")
255
-  (0.0ms) PRAGMA index_list("posts")
256
-  (0.0ms) PRAGMA index_list("users")
257
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
258
-  (0.1ms) select sqlite_version(*)
259
-  (2.6ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
260
-  (1.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
261
-  (1.2ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
262
-  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
263
-  (0.0ms) PRAGMA index_list("schema_migrations")
264
-  (0.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
265
-  (0.1ms) SELECT version FROM "schema_migrations"
266
-  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120311045747')
267
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
268
-  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')
269
-  (0.1ms) select sqlite_version(*)
270
-  (2.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
271
-  (0.0ms) PRAGMA index_list("schema_migrations")
272
-  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
273
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
274
- Migrating to CreateUsers (20120307051243)
275
-  (0.1ms) begin transaction
276
-  (0.4ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
277
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051243')
278
-  (0.7ms) commit transaction
279
- Migrating to CreatePosts (20120307051308)
280
-  (0.0ms) begin transaction
281
-  (0.4ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
282
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051308')
283
-  (0.8ms) commit transaction
284
- Migrating to CreateConnections (20120311000457)
285
-  (0.0ms) begin transaction
286
-  (0.4ms) CREATE TABLE "connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
287
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120311000457')
288
-  (0.7ms) commit transaction
289
-  (0.1ms) select sqlite_version(*)
290
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
291
-  (0.0ms) PRAGMA index_list("connections")
292
-  (0.0ms) PRAGMA index_list("posts")
293
-  (0.0ms) PRAGMA index_list("users")
294
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
295
-  (0.1ms) select sqlite_version(*)
296
-  (1.6ms) CREATE TABLE "connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
297
-  (1.6ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
298
-  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
299
-  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
300
-  (0.0ms) PRAGMA index_list("schema_migrations")
301
-  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
302
-  (0.1ms) SELECT version FROM "schema_migrations"
303
-  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120311000457')
304
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
305
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')
1
+ Connecting to database specified by database.yml
306
2
   (0.1ms) select sqlite_version(*)
307
-  (2.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
308
-  (0.0ms) PRAGMA index_list("schema_migrations")
309
-  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
310
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
311
- Migrating to CreateUsers (20120307051243)
312
-  (0.0ms) begin transaction
313
-  (0.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
314
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051243')
315
-  (0.8ms) commit transaction
316
- Migrating to CreatePosts (20120307051308)
317
-  (0.0ms) begin transaction
318
-  (0.3ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
319
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051308')
320
-  (1.3ms) commit transaction
321
- Migrating to CreateConnectionsConnections (20120311000457)
322
-  (0.1ms) begin transaction
323
-  (0.4ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
324
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120311000457')
325
-  (0.6ms) commit transaction
326
-  (0.1ms) select sqlite_version(*)
327
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
328
-  (0.0ms) PRAGMA index_list("connections_connections")
329
-  (0.0ms) PRAGMA index_list("posts")
330
-  (0.0ms) PRAGMA index_list("users")
331
-  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
332
-  (0.1ms) select sqlite_version(*)
333
-  (2.8ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
334
-  (1.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
335
-  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
336
-  (0.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
337
-  (0.1ms) PRAGMA index_list("schema_migrations")
338
-  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
+  (135.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
4
+  (4.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5
+  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
6
+ Connecting to database specified by database.yml
7
+  (1.5ms) select sqlite_version(*)
8
+  (41.7ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
9
+  (4.7ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
10
+  (4.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
339
11
   (0.1ms) SELECT version FROM "schema_migrations"
340
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120311000457')
341
-  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
342
-  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')
12
+  (5.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120311000457')
13
+  (4.4ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
14
+  (5.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')
15
+  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
16
+ Connecting to database specified by database.yml
17
+  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
18
+  (0.2ms) select sqlite_version(*)
19
+  (44.5ms) CREATE TABLE "connections_connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "connector_id" integer, "connectable_id" integer, "connector_type" varchar(255), "connectable_type" varchar(255), "type" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
20
+  (4.8ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
21
+  (3.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
22
+  (5.6ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
23
+  (4.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
24
+  (0.1ms) SELECT version FROM "schema_migrations"
25
+  (4.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20120311000457')
26
+  (4.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
27
+  (5.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')