polymorphic_render 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49f1255d4cab7de18fe2c3d291f13ae7a1d7e753
|
4
|
+
data.tar.gz: 59d6d075df9bbad727cad0da9e5b1cacac893b4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48c737c102941d1aac545e00887f4374b22be0858bb5bc29add404ba31298b0f8238a141bb0c603992826120d3458a6dd7cb02722d7a028500caf0f142d4ada0
|
7
|
+
data.tar.gz: 0e46dbce0d84fb9dc3363e7fa1453f17492b52b7355dd618b3ae8729af28ef310ee2e673ba3c580f8e97b0c17bc9ee792b6d836f846d5595df1444ec9713dd61
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module PolymorphicRender
|
2
2
|
module ApplicationHelper
|
3
|
-
def polymorphic_render(resource, suffix = nil)
|
3
|
+
def polymorphic_render(resource, suffix = nil, options = {})
|
4
4
|
if resource.is_a? ActiveRecord::Base
|
5
5
|
path = [resource.to_partial_path, *Array(suffix)].select(&:present?).join('_')
|
6
6
|
name = File.basename(resource.to_partial_path)
|
7
|
-
render partial: path, object: resource, as: name
|
7
|
+
render options.merge(partial: path, object: resource, as: name)
|
8
8
|
else
|
9
9
|
capture do
|
10
|
-
resource.each{ |res| concat polymorphic_render(res, suffix) }
|
10
|
+
resource.each{ |res| concat polymorphic_render(res, suffix, options) }
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/test/dummy/log/test.log
CHANGED
@@ -310,5 +310,75 @@ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
|
|
310
310
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
311
311
|
---------------------------------
|
312
312
|
PolymorphicRenderTest: test_truth
|
313
|
+
---------------------------------
|
314
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
315
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
316
|
+
---------------------------------------------------------------------------
|
317
|
+
PolymorphicRender::ApplicationHelperTest: test_complex_namespaced_rendering
|
318
|
+
---------------------------------------------------------------------------
|
319
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
320
|
+
[1m[36mSQL (5.5ms)[0m [1mINSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "My First Post"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
321
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
322
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
323
|
+
[1m[35mSQL (1.4ms)[0m INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
324
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
325
|
+
Rendered posts/_post_admin.html.erb (2.2ms)
|
326
|
+
Rendered posts/_post_super_admin.html.erb (0.6ms)
|
327
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
328
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
329
|
+
------------------------------------------------------------------------------
|
330
|
+
PolymorphicRender::ApplicationHelperTest: test_namespaced_collection_rendering
|
331
|
+
------------------------------------------------------------------------------
|
332
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
333
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "My First Post"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
334
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
335
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
336
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
337
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
338
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts"
|
339
|
+
Rendered posts/_post_admin.html.erb (0.1ms)
|
340
|
+
Rendered posts/_post_admin.html.erb (0.1ms)
|
341
|
+
[1m[36m (0.4ms)[0m [1mrollback transaction[0m
|
342
|
+
[1m[35m (0.0ms)[0m begin transaction
|
343
|
+
-------------------------------------------------------------------
|
344
|
+
PolymorphicRender::ApplicationHelperTest: test_namespaced_rendering
|
345
|
+
-------------------------------------------------------------------
|
346
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
347
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "My First Post"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
348
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
349
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
350
|
+
[1m[36mSQL (3.1ms)[0m [1mINSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
351
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
352
|
+
Rendered posts/_post_admin.html.erb (0.1ms)
|
353
|
+
[1m[36m (0.5ms)[0m [1mrollback transaction[0m
|
354
|
+
[1m[35m (0.1ms)[0m begin transaction
|
355
|
+
--------------------------------------------------------------------------
|
356
|
+
PolymorphicRender::ApplicationHelperTest: test_simple_collection_rendering
|
357
|
+
--------------------------------------------------------------------------
|
358
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
359
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "My First Post"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
360
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
361
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
362
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
363
|
+
[1m[35m (0.0ms)[0m RELEASE SAVEPOINT active_record_1
|
364
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
365
|
+
Rendered posts/_post.html.erb (0.6ms)
|
366
|
+
Rendered posts/_post.html.erb (0.1ms)
|
367
|
+
[1m[35m (0.4ms)[0m rollback transaction
|
368
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
369
|
+
---------------------------------------------------------------
|
370
|
+
PolymorphicRender::ApplicationHelperTest: test_simple_rendering
|
371
|
+
---------------------------------------------------------------
|
372
|
+
[1m[35m (0.0ms)[0m SAVEPOINT active_record_1
|
373
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?)[0m [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "My First Post"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
374
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
375
|
+
[1m[36m (0.0ms)[0m [1mSAVEPOINT active_record_1[0m
|
376
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Fri, 12 Dec 2014 09:25:20 UTC +00:00]]
|
377
|
+
[1m[36m (0.0ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
378
|
+
Rendered posts/_post.html.erb (0.1ms)
|
379
|
+
[1m[35m (0.3ms)[0m rollback transaction
|
380
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
381
|
+
---------------------------------
|
382
|
+
PolymorphicRenderTest: test_truth
|
313
383
|
---------------------------------
|
314
384
|
[1m[35m (0.0ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polymorphic_render
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikhail Dieterle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|