feedable 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/feedable.rb +3 -3
- data/lib/feedable/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +79 -0
- metadata +2 -2
data/lib/feedable.rb
CHANGED
@@ -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
|
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['
|
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['
|
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
|
data/lib/feedable/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -1144,3 +1144,82 @@ Connecting to database specified by database.yml
|
|
1144
1144
|
[1m[35m (0.0ms)[0m rollback transaction
|
1145
1145
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1146
1146
|
[1m[35m (0.0ms)[0m rollback transaction
|
1147
|
+
Connecting to database specified by database.yml
|
1148
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
1149
|
+
[1m[35mFixture Delete (0.6ms)[0m DELETE FROM "alligators"
|
1150
|
+
[1m[36mFixture Insert (0.2ms)[0m [1mINSERT INTO "alligators" ("name", "created_at", "updated_at", "id") VALUES ('James', '2012-01-01 00:00:00', '2012-01-01 00:00:00', 727736359)[0m
|
1151
|
+
[1m[35mFixture Insert (0.1ms)[0m 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
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT INTO "alligators" ("name", "created_at", "updated_at", "id") VALUES ('Cameron', '2012-03-01 00:00:00', '2012-03-01 00:00:00', 91095304)[0m
|
1153
|
+
[1m[35mFixture Delete (0.1ms)[0m DELETE FROM "posts"
|
1154
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT 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)[0m
|
1155
|
+
[1m[35mFixture Insert (0.0ms)[0m 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
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT 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)[0m
|
1157
|
+
[1m[35mFixture Delete (0.1ms)[0m DELETE FROM "roosters"
|
1158
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT 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)[0m
|
1159
|
+
[1m[35mFixture Insert (0.0ms)[0m 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
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT 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)[0m
|
1161
|
+
[1m[35mFixture Delete (0.1ms)[0m DELETE FROM "trumpets"
|
1162
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT 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)[0m
|
1163
|
+
[1m[35mFixture Insert (0.0ms)[0m 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
|
+
[1m[36mFixture Insert (0.0ms)[0m [1mINSERT 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)[0m
|
1165
|
+
[1m[35m (0.9ms)[0m commit transaction
|
1166
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1167
|
+
[1m[35mRooster Load (0.3ms)[0m SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 217118453]]
|
1168
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1169
|
+
[1m[35mSQL (2.8ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1171
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT * FROM "posts" WHERE "posts"."id" = ? LIMIT 1[0m [["id", 1048705901]]
|
1173
|
+
[1m[35mRooster Load (0.1ms)[0m SELECT * FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 217118453]]
|
1174
|
+
[1m[36mAlligator Load (0.1ms)[0m [1mSELECT * FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1[0m [["id", 217118453]]
|
1175
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1048705901]]
|
1176
|
+
[1m[36m (0.8ms)[0m [1mrollback transaction[0m
|
1177
|
+
[1m[35m (0.1ms)[0m begin transaction
|
1178
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
1179
|
+
[1m[35m (0.0ms)[0m begin transaction
|
1180
|
+
[1m[36m (0.4ms)[0m [1mselect * 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[0m
|
1181
|
+
[1m[35mPost Load (0.1ms)[0m SELECT * FROM "posts" WHERE "posts"."id" IN (1048705901, 159828990, 277846598)
|
1182
|
+
[1m[36mRooster Load (0.1ms)[0m [1mSELECT * FROM "roosters" WHERE "roosters"."id" IN (217118453, 1006093928, 587110368)[0m
|
1183
|
+
[1m[35mAlligator Load (0.1ms)[0m SELECT * FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783, 727736359)
|
1184
|
+
[1m[36mRooster Load (0.0ms)[0m [1mSELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1[0m [["id", 217118453]]
|
1185
|
+
[1m[35mPost Load (0.0ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1048705901]]
|
1186
|
+
[1m[36mAlligator Load (0.1ms)[0m [1mSELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1[0m [["id", 91095304]]
|
1187
|
+
[1m[35mRooster Load (0.0ms)[0m SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 1006093928]]
|
1188
|
+
[1m[36mPost Load (0.0ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1[0m [["id", 159828990]]
|
1189
|
+
[1m[35mAlligator Load (0.0ms)[0m SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 845754783]]
|
1190
|
+
[1m[36mRooster Load (0.0ms)[0m [1mSELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1[0m [["id", 587110368]]
|
1191
|
+
[1m[35mPost Load (0.0ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 277846598]]
|
1192
|
+
[1m[36mAlligator Load (0.0ms)[0m [1mSELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1[0m [["id", 727736359]]
|
1193
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1194
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1195
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36mAlligator Load (0.0ms)[0m [1mSELECT * FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1[0m [["id", 91095304]]
|
1197
|
+
[1m[35mPost Load (0.1ms)[0m SELECT * FROM "posts" WHERE "posts"."id" IN (1048705901, 159828990)
|
1198
|
+
[1m[36mRooster Load (0.1ms)[0m [1mSELECT * FROM "roosters" WHERE "roosters"."id" IN (217118453, 1006093928)[0m
|
1199
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1200
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1201
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36mAlligator Load (0.1ms)[0m [1mSELECT * FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783)[0m
|
1203
|
+
[1m[35mPost Load (0.0ms)[0m SELECT * FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 159828990]]
|
1204
|
+
[1m[36mRooster Load (0.1ms)[0m [1mSELECT * FROM "roosters" WHERE "roosters"."id" IN (1006093928, 587110368)[0m
|
1205
|
+
[1m[35mAlligator Load (0.0ms)[0m SELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1 [["id", 91095304]]
|
1206
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
1207
|
+
[1m[35m (0.0ms)[0m begin transaction
|
1208
|
+
[1m[36m (0.3ms)[0m [1mselect * 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[0m
|
1209
|
+
[1m[35mAlligator Load (0.1ms)[0m SELECT * FROM "alligators" WHERE "alligators"."id" IN (727736359, 845754783, 91095304)
|
1210
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT * FROM "posts" WHERE "posts"."id" IN (277846598, 159828990, 1048705901)[0m
|
1211
|
+
[1m[35mRooster Load (0.1ms)[0m SELECT * FROM "roosters" WHERE "roosters"."id" IN (587110368, 1006093928, 217118453)
|
1212
|
+
[1m[36mAlligator Load (0.0ms)[0m [1mSELECT "alligators".* FROM "alligators" WHERE "alligators"."id" = ? LIMIT 1[0m [["id", 727736359]]
|
1213
|
+
[1m[35m (0.3ms)[0m 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
|
+
[1m[36mAlligator Load (0.1ms)[0m [1mSELECT * FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783, 727736359)[0m
|
1215
|
+
[1m[35mPost Load (0.1ms)[0m SELECT * FROM "posts" WHERE "posts"."id" IN (1048705901, 159828990, 277846598)
|
1216
|
+
[1m[36mRooster Load (0.1ms)[0m [1mSELECT * FROM "roosters" WHERE "roosters"."id" IN (217118453, 1006093928, 587110368)[0m
|
1217
|
+
[1m[35mRooster Load (0.0ms)[0m SELECT "roosters".* FROM "roosters" WHERE "roosters"."id" = ? LIMIT 1 [["id", 217118453]]
|
1218
|
+
[1m[36m (0.0ms)[0m [1mrollback transaction[0m
|
1219
|
+
[1m[35m (0.0ms)[0m begin transaction
|
1220
|
+
[1m[36m (0.3ms)[0m [1mselect * 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[0m
|
1221
|
+
[1m[35mPost Load (0.0ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = ? LIMIT 1 [["id", 1048705901]]
|
1222
|
+
[1m[36mAlligator Load (0.1ms)[0m [1mSELECT "alligators".* FROM "alligators" WHERE "alligators"."id" IN (91095304, 845754783, 727736359)[0m
|
1223
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
1224
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1225
|
+
[1m[35m (0.0ms)[0m 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.
|
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-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|