polymorphic_render 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14731099d4f17a9ea2cc030dcfd544ccde47f10e
4
- data.tar.gz: 942a5e4d932dbab32f31ff35d61862a693c26f0a
3
+ metadata.gz: 49f1255d4cab7de18fe2c3d291f13ae7a1d7e753
4
+ data.tar.gz: 59d6d075df9bbad727cad0da9e5b1cacac893b4d
5
5
  SHA512:
6
- metadata.gz: e81afe5ee7ad1c429b6aa8f0dc60078b54e30a9ba795d7ee4c7212142d8ac31a9db3b3a1ef97bb89c9c7b8ad40236b98c6ceb84bf8a6da1906fac298f46424f8
7
- data.tar.gz: 617b1542db7002bba88ef79592c9604223b999c17a3fd72f552c1ac7b57269a1e43b5e9a6e305976d29a2ada4dc48a4137dc8a77d3b0b880696f7f7046968884
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
@@ -1,3 +1,3 @@
1
1
  module PolymorphicRender
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -310,5 +310,75 @@ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
310
310
   (0.0ms) begin transaction
311
311
  ---------------------------------
312
312
  PolymorphicRenderTest: test_truth
313
+ ---------------------------------
314
+  (0.0ms) rollback transaction
315
+  (0.4ms) begin transaction
316
+ ---------------------------------------------------------------------------
317
+ PolymorphicRender::ApplicationHelperTest: test_complex_namespaced_rendering
318
+ ---------------------------------------------------------------------------
319
+  (0.1ms) SAVEPOINT active_record_1
320
+ SQL (5.5ms) 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]]
321
+  (0.1ms) RELEASE SAVEPOINT active_record_1
322
+  (0.2ms) SAVEPOINT active_record_1
323
+ SQL (1.4ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
325
+ Rendered posts/_post_admin.html.erb (2.2ms)
326
+ Rendered posts/_post_super_admin.html.erb (0.6ms)
327
+  (0.4ms) rollback transaction
328
+  (0.1ms) begin transaction
329
+ ------------------------------------------------------------------------------
330
+ PolymorphicRender::ApplicationHelperTest: test_namespaced_collection_rendering
331
+ ------------------------------------------------------------------------------
332
+  (0.1ms) SAVEPOINT active_record_1
333
+ SQL (0.4ms) 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]]
334
+  (0.1ms) RELEASE SAVEPOINT active_record_1
335
+  (0.0ms) SAVEPOINT active_record_1
336
+ SQL (0.4ms) 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
+  (0.0ms) RELEASE SAVEPOINT active_record_1
338
+ Post Load (0.1ms) SELECT "posts".* FROM "posts"
339
+ Rendered posts/_post_admin.html.erb (0.1ms)
340
+ Rendered posts/_post_admin.html.erb (0.1ms)
341
+  (0.4ms) rollback transaction
342
+  (0.0ms) begin transaction
343
+ -------------------------------------------------------------------
344
+ PolymorphicRender::ApplicationHelperTest: test_namespaced_rendering
345
+ -------------------------------------------------------------------
346
+  (0.0ms) SAVEPOINT active_record_1
347
+ SQL (0.4ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
349
+  (0.0ms) SAVEPOINT active_record_1
350
+ SQL (3.1ms) 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]]
351
+  (0.1ms) RELEASE SAVEPOINT active_record_1
352
+ Rendered posts/_post_admin.html.erb (0.1ms)
353
+  (0.5ms) rollback transaction
354
+  (0.1ms) begin transaction
355
+ --------------------------------------------------------------------------
356
+ PolymorphicRender::ApplicationHelperTest: test_simple_collection_rendering
357
+ --------------------------------------------------------------------------
358
+  (0.0ms) SAVEPOINT active_record_1
359
+ SQL (0.4ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
361
+  (0.0ms) SAVEPOINT active_record_1
362
+ SQL (0.4ms) 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]]
363
+  (0.0ms) RELEASE SAVEPOINT active_record_1
364
+ Post Load (0.1ms) SELECT "posts".* FROM "posts"
365
+ Rendered posts/_post.html.erb (0.6ms)
366
+ Rendered posts/_post.html.erb (0.1ms)
367
+  (0.4ms) rollback transaction
368
+  (0.1ms) begin transaction
369
+ ---------------------------------------------------------------
370
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
371
+ ---------------------------------------------------------------
372
+  (0.0ms) SAVEPOINT active_record_1
373
+ SQL (0.4ms) 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]]
374
+  (0.1ms) RELEASE SAVEPOINT active_record_1
375
+  (0.0ms) SAVEPOINT active_record_1
376
+ SQL (0.5ms) 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
+  (0.0ms) RELEASE SAVEPOINT active_record_1
378
+ Rendered posts/_post.html.erb (0.1ms)
379
+  (0.3ms) rollback transaction
380
+  (0.1ms) begin transaction
381
+ ---------------------------------
382
+ PolymorphicRenderTest: test_truth
313
383
  ---------------------------------
314
384
   (0.0ms) 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.0
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-05 00:00:00.000000000 Z
11
+ date: 2014-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails