connections 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # Connections
2
+
3
+ Most social apps needs some kind of follow/like/watch/stalk/etc
4
+ feature that connects one model to another.
5
+
6
+ Instead of having to recreate this functionality for every project we
7
+ decided to create a gem that easily allows you to add these features
8
+ using any naming you prefer.
9
+
10
+ ## Installation
11
+
12
+ Add the gem to the gemfile:
13
+ `gem "connections"`
14
+
15
+ Install migration:
16
+ `rake connections:install:migrations`
17
+
18
+ This generates a migration that creates a single join table for
19
+ keeping track of what is connected to what.
20
+
21
+ ## Usage
22
+
23
+ Use `connects_with` and `connectable_with` to add connection capabilities to any model using
24
+ whatever naming scheme you prefer (follow, like, watch, etc)
25
+
26
+ class User < ActiveRecord::Base
27
+ connects_with :follow, :like
28
+ connectable_with :follow
29
+ end
30
+
31
+ class Post < ActiveRecord::Base
32
+ connectable_with :like
33
+ end
34
+
35
+ This will add following methods:
36
+
37
+ # Follow
38
+ user.follow(other_user) # Creates a 'Follow' connection from user -> other_user
39
+ user.unfollow(other_user) # Removes 'Follow' connection between user -> other_user
40
+ user.toggle_follow(other_user) # Toggles the connection on/off (useful for toggle buttons)
41
+ user.follows?(other_user) # Returns true if the user if following other_user
42
+ user.followings(:user) # Returns a list of all the users the user is following
43
+ other_user.followers(:user) #Returns a list of all the user's followers
44
+
45
+ # Like
46
+ user.like(post)
47
+ user.unlike(post)
48
+ user.toggle_like(post)
49
+ user.likes?(post)
50
+ user.likings(:post)
51
+ post.likers(:user)
52
+
53
+ That's it! If you want to add extra functionality to the join model (such
54
+ as using callbacks etc) you can explicitly define the model in your
55
+ project like this:
56
+
57
+ class Follow < Connections::Connection
58
+ ...
59
+ end
60
+
61
+ ## Credits
62
+
63
+ This gem was inspired by [socialization](https://github.com/cmer/socialization) that although it didn't quite do what we needed is a pretty useful tool.
64
+
65
+
66
+ ## Copyright
67
+
68
+ Copyright (c) 2012 Jens Balvig -- Released under the MIT license.
data/Rakefile CHANGED
@@ -20,6 +20,8 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
23
25
 
24
26
 
25
27
 
File without changes
@@ -1,11 +1,11 @@
1
- class CreateConnections < ActiveRecord::Migration
1
+ class CreateConnectionsConnections < ActiveRecord::Migration
2
2
  def change
3
- create_table :connections do |t|
4
- t.string :type
5
- t.string :connectable_type
3
+ create_table :connections_connections do |t|
4
+ t.integer :connector_id
6
5
  t.integer :connectable_id
7
6
  t.string :connector_type
8
- t.integer :connector_id
7
+ t.string :connectable_type
8
+ t.string :type
9
9
 
10
10
  t.timestamps
11
11
  end
data/lib/connections.rb CHANGED
@@ -1,6 +1,6 @@
1
- require "connections/connection"
2
- require "connections/connector"
3
- require "connections/connectable"
1
+ require 'connections/engine'
2
+ require 'connections/connector'
3
+ require 'connections/connectable'
4
4
 
5
5
  module Connections
6
6
  end
@@ -11,7 +11,7 @@ module Connections
11
11
  # user.followers(:user)
12
12
  define_method :"#{t.to_s.sub(/e$/,'')}ers" do |class_name|
13
13
  klass = class_name.to_s.classify.constantize
14
- klass.joins(:connections).where("connections.type = ? AND connectable_type = ? AND connectable_id = ?", t.to_s.classify, self.class.table_name.classify, self)
14
+ klass.joins(:connections).where("connections_connections.type = ? AND connectable_type = ? AND connectable_id = ?", t.to_s.classify, self.class.table_name.classify, self)
15
15
  end
16
16
  end
17
17
  end
@@ -44,7 +44,7 @@ module Connections
44
44
  # user.following(:user)
45
45
  define_method :"#{t.to_s.sub(/e$/,'')}ing" do |class_name|
46
46
  klass = class_name.to_s.classify.constantize
47
- klass.joins(:incoming_connections).where("connections.type = ? AND connector_type = ? AND connector_id = ?", t.to_s.classify, self.class.table_name.classify, self)
47
+ klass.joins(:incoming_connections).where("connections_connections.type = ? AND connector_type = ? AND connector_id = ?", t.to_s.classify, self.class.table_name.classify, self)
48
48
  end
49
49
  end
50
50
  end
@@ -0,0 +1,5 @@
1
+ module Connections
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Connections
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Connections
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -82,5 +82,4 @@ class ConnectionsTest < ActiveSupport::TestCase
82
82
  end
83
83
 
84
84
  end
85
-
86
85
  end
@@ -1,58 +1,2 @@
1
- Dummy::Application.routes.draw do
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
4
-
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
8
-
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
12
-
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
- # resources :products
15
-
16
- # Sample resource route with options:
17
- # resources :products do
18
- # member do
19
- # get 'short'
20
- # post 'toggle'
21
- # end
22
- #
23
- # collection do
24
- # get 'sold'
25
- # end
26
- # end
27
-
28
- # Sample resource route with sub-resources:
29
- # resources :products do
30
- # resources :comments, :sales
31
- # resource :seller
32
- # end
33
-
34
- # Sample resource route with more complex sub-resources
35
- # resources :products do
36
- # resources :comments
37
- # resources :sales do
38
- # get 'recent', :on => :collection
39
- # end
40
- # end
41
-
42
- # Sample resource route within a namespace:
43
- # namespace :admin do
44
- # # Directs /admin/products/* to Admin::ProductsController
45
- # # (app/controllers/admin/products_controller.rb)
46
- # resources :products
47
- # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => 'welcome#index'
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- # match ':controller(/:action(/:id))(.:format)'
1
+ Rails.application.routes.draw do
58
2
  end
Binary file
@@ -10,14 +10,14 @@
10
10
  #
11
11
  # It's strongly recommended to check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(:version => 20120307052433) do
13
+ ActiveRecord::Schema.define(:version => 20120311000457) do
14
14
 
15
- create_table "connections", :force => true do |t|
16
- t.string "type"
17
- t.string "connectable_type"
15
+ create_table "connections_connections", :force => true do |t|
16
+ t.integer "connector_id"
18
17
  t.integer "connectable_id"
19
18
  t.string "connector_type"
20
- t.integer "connector_id"
19
+ t.string "connectable_type"
20
+ t.string "type"
21
21
  t.datetime "created_at", :null => false
22
22
  t.datetime "updated_at", :null => false
23
23
  end
Binary file
@@ -1,55 +1,342 @@
1
1
   (0.2ms) select sqlite_version(*)
2
-  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
3
-  (0.1ms) PRAGMA index_list("schema_migrations")
4
-  (1.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("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")
5
40
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
6
41
  Migrating to CreateUsers (20120307051243)
7
-  (0.1ms) begin transaction
8
-  (0.5ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
9
-  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051243')
10
-  (0.9ms) commit transaction
11
42
  Migrating to CreatePosts (20120307051308)
12
-  (0.1ms) begin transaction
13
-  (0.5ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
14
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307051308')
15
-  (0.8ms) commit transaction
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
16
68
   (0.1ms) select sqlite_version(*)
17
69
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
18
70
   (0.0ms) PRAGMA index_list("posts")
19
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" 
20
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)
21
98
   (0.1ms) select sqlite_version(*)
22
-  (1.5ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
23
-  (1.2ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
24
-  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
25
-  (0.0ms) PRAGMA index_list("schema_migrations")
26
-  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
27
-  (0.1ms) SELECT version FROM "schema_migrations"
28
-  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')
29
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
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")
30
103
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
31
104
  Migrating to CreateUsers (20120307051243)
32
105
  Migrating to CreatePosts (20120307051308)
33
- Migrating to CreateConnections (20120307052433)
34
-  (0.0ms) select sqlite_version(*)
35
-  (0.0ms) begin transaction
36
-  (0.4ms) CREATE TABLE "connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "connectable_type" varchar(255), "connectable_id" integer, "connector_type" varchar(255), "connector_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
37
-  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20120307052433')
38
-  (2.6ms) commit transaction
39
-  (0.1ms) select sqlite_version(*)
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(*)
40
167
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
41
-  (0.0ms) PRAGMA index_list("connections")
168
+  (0.0ms) PRAGMA index_list("connections_connections")
42
169
   (0.0ms) PRAGMA index_list("posts")
43
170
   (0.0ms) PRAGMA index_list("users")
44
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
45
200
   (0.1ms) select sqlite_version(*)
46
-  (2.6ms) CREATE TABLE "connections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "type" varchar(255), "connectable_type" varchar(255), "connectable_id" integer, "connector_type" varchar(255), "connector_id" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
47
-  (1.3ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
48
-  (1.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
49
-  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
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)
50
234
   (0.0ms) PRAGMA index_list("schema_migrations")
51
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")
52
302
   (0.1ms) SELECT version FROM "schema_migrations"
53
-  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307052433')
54
-  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
303
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120311000457')
304
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051243')
55
305
   (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120307051308')
306
+  (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")
339
+  (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')