feedable 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,7 +33,7 @@ def feedable(*args)
33
33
  tmp.offset_value = nil
34
34
 
35
35
  # add to unions
36
- tmp.select_values = ["#{tmp.primary_key} as key", "#{tmp.feedable_col} as dtim", "'#{tmp.klass}' as type"]
36
+ tmp.select_values = ["#{tmp.primary_key} as keyfld", "#{tmp.feedable_col} as dtim", "'#{tmp.klass}' as type"]
37
37
  clauses.push tmp.to_sql
38
38
  end
39
39
 
@@ -55,12 +55,12 @@ def feedable(*args)
55
55
  q.offset_value = nil
56
56
 
57
57
  # collect ids
58
- ids = all_ids.select{|x| x['type'] == q.klass.name}.collect{|x| x['key']}
58
+ ids = all_ids.select{|x| x['type'] == q.klass.name}.collect{|x| x['keyfld']}
59
59
  recs = q.find(ids)
60
60
 
61
61
  # attach to the output
62
62
  recs.each do |r|
63
- idx = all_ids.index {|x| x['key'] == r.id && x['type'] == q.klass.name}
63
+ idx = all_ids.index {|x| x['keyfld'] == r.id && x['type'] == q.klass.name}
64
64
  all_recs[idx] = r
65
65
  end
66
66
  end
@@ -1,3 +1,3 @@
1
1
  module Feedable
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
Binary file
@@ -1144,3 +1144,82 @@ Connecting to database specified by database.yml
1144
1144
   (0.0ms) rollback transaction
1145
1145
   (0.0ms) begin transaction
1146
1146
   (0.0ms) rollback transaction
1147
+ Connecting to database specified by database.yml
1148
+  (0.4ms) begin transaction
1149
+ Fixture Delete (0.6ms) DELETE FROM "alligators"
1150
+ Fixture Insert (0.2ms) INSERT INTO "alligators" ("name", "created_at", "updated_at", "id") VALUES ('James', '2012-01-01 00:00:00', '2012-01-01 00:00:00', 727736359)
1151
+ Fixture Insert (0.1ms) INSERT INTO "alligators" ("name", "created_at", "updated_at", "id") VALUES ('Spot', '2012-02-01 00:00:00', '2012-02-01 00:00:00', 845754783)
1152
+ Fixture Insert (0.0ms) INSERT INTO "alligators" ("name", "created_at", "updated_at", "id") VALUES ('Cameron', '2012-03-01 00:00:00', '2012-03-01 00:00:00', 91095304)
1153
+ Fixture Delete (0.1ms) DELETE FROM "posts"
1154
+ Fixture Insert (0.1ms) INSERT INTO "posts" ("title", "desc", "created_at", "updated_at", "id") VALUES ('The first post', 'this is the first thing', '2012-01-05 00:00:00', '2012-01-05 00:00:00', 277846598)
1155
+ Fixture Insert (0.0ms) INSERT INTO "posts" ("title", "desc", "created_at", "updated_at", "id") VALUES ('Post the second', 'in between them', '2012-02-05 00:00:00', '2012-02-05 00:00:00', 159828990)
1156
+ Fixture Insert (0.1ms) INSERT INTO "posts" ("title", "desc", "created_at", "updated_at", "id") VALUES ('Poster 3', 'and the last one', '2012-03-05 00:00:00', '2012-03-05 00:00:00', 1048705901)
1157
+ Fixture Delete (0.1ms) DELETE FROM "roosters"
1158
+ Fixture Insert (0.1ms) INSERT INTO "roosters" ("kind", "awesomeness", "created_at", "updated_at", "id") VALUES ('The first roostr', 4, '2012-01-10 00:00:00', '2012-01-10 00:00:00', 587110368)
1159
+ Fixture Insert (0.0ms) INSERT INTO "roosters" ("kind", "awesomeness", "created_at", "updated_at", "id") VALUES ('roostr the second', 100, '2012-02-10 00:00:00', '2012-02-10 00:00:00', 1006093928)
1160
+ Fixture Insert (0.0ms) INSERT INTO "roosters" ("kind", "awesomeness", "created_at", "updated_at", "id") VALUES ('roostr 3', 5, '2012-03-10 00:00:00', '2012-03-10 00:00:00', 217118453)
1161
+ Fixture Delete (0.1ms) DELETE FROM "trumpets"
1162
+ Fixture Insert (0.1ms) INSERT INTO "trumpets" ("brand", "loudness", "created_at", "updated_at", "id") VALUES ('yamaha', 'a bit', '2012-01-15 00:00:00', '2012-01-15 00:00:00', 587110368)
1163
+ Fixture Insert (0.0ms) INSERT INTO "trumpets" ("brand", "loudness", "created_at", "updated_at", "id") VALUES ('bach', 'earth shattering', '2012-02-15 00:00:00', '2012-02-15 00:00:00', 1006093928)
1164
+ Fixture Insert (0.0ms) INSERT INTO "trumpets" ("brand", "loudness", "created_at", "updated_at", "id") VALUES ('getzen', 'annoying', '2012-03-15 00:00:00', '2012-03-15 00:00:00', 217118453)
1165
+  (0.9ms) commit transaction
1166
+  (0.0ms) begin transaction
1167
+ Rooster Load (0.3ms) SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 217118453]]
1168
+  (0.1ms) SAVEPOINT active_record_1
1169
+ SQL (2.8ms) INSERT INTO "alligators" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Fri, 14 Sep 2012 04:07:17 UTC +00:00], ["id", 217118453], ["name", nil], ["updated_at", Fri, 14 Sep 2012 04:07:17 UTC +00:00]]
1170
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1171
+  (0.3ms) select * from (SELECT id as keyfld, created_at as dtim, 'Post' as type FROM "posts" UNION SELECT id as keyfld, created_at as dtim, 'Rooster' as type FROM "roosters" UNION SELECT id as keyfld, created_at as dtim, 'Alligator' as type FROM "alligators" ) order by dtim desc limit 3 offset 0
1172
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1048705901]]
1173
+ Rooster Load (0.1ms) SELECT * FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 217118453]]
1174
+ Alligator Load (0.1ms) SELECT * FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 217118453]]
1175
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1048705901]]
1176
+  (0.8ms) rollback transaction
1177
+  (0.1ms) begin transaction
1178
+  (0.0ms) rollback transaction
1179
+  (0.0ms) begin transaction
1180
+  (0.4ms) select * from (SELECT id as keyfld, created_at as dtim, 'Post' as type FROM "posts" UNION SELECT id as keyfld, created_at as dtim, 'Rooster' as type FROM "roosters" UNION SELECT id as keyfld, created_at as dtim, 'Alligator' as type FROM "alligators" ) order by dtim desc limit 100 offset 0
1181
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE "posts"."id" IN (1048705901, 159828990, 277846598)
1182
+ Rooster Load (0.1ms) SELECT * FROM "roosters" WHERE "roosters"."id" IN (217118453, 1006093928, 587110368)
1183
+ Alligator Load (0.1ms) SELECT * FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783, 727736359)
1184
+ Rooster Load (0.0ms) SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 217118453]]
1185
+ Post Load (0.0ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1048705901]]
1186
+ Alligator Load (0.1ms) SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 91095304]]
1187
+ Rooster Load (0.0ms) SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 1006093928]]
1188
+ Post Load (0.0ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 159828990]]
1189
+ Alligator Load (0.0ms) SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 845754783]]
1190
+ Rooster Load (0.0ms) SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 587110368]]
1191
+ Post Load (0.0ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 277846598]]
1192
+ Alligator Load (0.0ms) SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 727736359]]
1193
+  (0.0ms) rollback transaction
1194
+  (0.0ms) begin transaction
1195
+  (0.3ms) select * from (SELECT id as keyfld, created_at as dtim, 'Alligator' as type FROM "alligators" UNION SELECT id as keyfld, created_at as dtim, 'Post' as type FROM "posts" UNION SELECT id as keyfld, created_at as dtim, 'Rooster' as type FROM "roosters" ) order by dtim desc limit 5 offset 0
1196
+ Alligator Load (0.0ms) SELECT * FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 91095304]]
1197
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE "posts"."id" IN (1048705901, 159828990)
1198
+ Rooster Load (0.1ms) SELECT * FROM "roosters" WHERE "roosters"."id" IN (217118453, 1006093928)
1199
+  (0.0ms) rollback transaction
1200
+  (0.0ms) begin transaction
1201
+  (0.3ms) select * from (SELECT id as keyfld, created_at as dtim, 'Alligator' as type FROM "alligators" UNION SELECT id as keyfld, created_at as dtim, 'Post' as type FROM "posts" UNION SELECT id as keyfld, created_at as dtim, 'Rooster' as type FROM "roosters" ) order by dtim desc limit 5 offset 2
1202
+ Alligator Load (0.1ms) SELECT * FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783)
1203
+ Post Load (0.0ms) SELECT * FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 159828990]]
1204
+ Rooster Load (0.1ms) SELECT * FROM "roosters" WHERE "roosters"."id" IN (1006093928, 587110368)
1205
+ Alligator Load (0.0ms) SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 91095304]]
1206
+  (0.0ms) rollback transaction
1207
+  (0.0ms) begin transaction
1208
+  (0.3ms) select * from (SELECT id as keyfld, created_at as dtim, 'Alligator' as type FROM "alligators" UNION SELECT id as keyfld, created_at as dtim, 'Post' as type FROM "posts" UNION SELECT id as keyfld, created_at as dtim, 'Rooster' as type FROM "roosters" ) order by dtim asc limit 100 offset 0
1209
+ Alligator Load (0.1ms) SELECT * FROM "alligators" WHERE "alligators"."id" IN (727736359, 845754783, 91095304)
1210
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE "posts"."id" IN (277846598, 159828990, 1048705901)
1211
+ Rooster Load (0.1ms) SELECT * FROM "roosters" WHERE "roosters"."id" IN (587110368, 1006093928, 217118453)
1212
+ Alligator Load (0.0ms) SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 727736359]]
1213
+  (0.3ms) select * from (SELECT id as keyfld, created_at as dtim, 'Alligator' as type FROM "alligators" UNION SELECT id as keyfld, created_at as dtim, 'Post' as type FROM "posts" UNION SELECT id as keyfld, created_at as dtim, 'Rooster' as type FROM "roosters" ) order by dtim desc limit 100 offset 0
1214
+ Alligator Load (0.1ms) SELECT * FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783, 727736359)
1215
+ Post Load (0.1ms) SELECT * FROM "posts" WHERE "posts"."id" IN (1048705901, 159828990, 277846598)
1216
+ Rooster Load (0.1ms) SELECT * FROM "roosters" WHERE "roosters"."id" IN (217118453, 1006093928, 587110368)
1217
+ Rooster Load (0.0ms) SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 217118453]]
1218
+  (0.0ms) rollback transaction
1219
+  (0.0ms) begin transaction
1220
+  (0.3ms) select * from (SELECT id as keyfld, created_at as dtim, 'Post' as type FROM "posts" WHERE (title='Poster 3') UNION SELECT id as keyfld, created_at as dtim, 'Rooster' as type FROM "roosters" WHERE (kind='DNE') UNION SELECT id as keyfld, created_at as dtim, 'Alligator' as type FROM "alligators" WHERE (name is not null)) order by dtim desc limit 100 offset 0
1221
+ Post Load (0.0ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1048705901]]
1222
+ Alligator Load (0.1ms) SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783, 727736359)
1223
+  (0.0ms) rollback transaction
1224
+  (0.0ms) begin transaction
1225
+  (0.0ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-01 00:00:00.000000000 Z
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails