effective_bootstrap 1.15.4 → 1.15.6

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
  SHA256:
3
- metadata.gz: a0b4a7fe4e2f857905f320457741daaefadd0715c14da32227981aa78ca517f0
4
- data.tar.gz: a096063d2e4dbcb5150f8ed04aced9dd134677478b9fdb11872d3808c5d28729
3
+ metadata.gz: 1cd2eede1a173ecbaaad8b73be59e3797c9712f934ce632af425383782ef0db8
4
+ data.tar.gz: 31585f4657f8dabb81ed0f0b00adc54922a1648831a2c13d03f93d5c03981c01
5
5
  SHA512:
6
- metadata.gz: 990544862a2d241595d88b7db747521da38240fa388485beb20dcc80c63a0c9d00cb208af1809ae57ad1f4afa4be48d42c199d0daad48901a6a037475446dbdc
7
- data.tar.gz: e25a152504f843951f9da06bef135e6f453c464328149fc1558664afe8ba3f0335b294485eefc1b58c335e3dbe21b12ddbb578097e9233e2f2104d28c2c151c4
6
+ metadata.gz: 0fce3aba0d09b7b423fc02910bf7e95f710663cf239bb2d78eaf76ef8768ab26f45d95a6dd9e8c8b01c5ddfaaaa4e934f8f36b535249690dd8d33cf1c83d6a74
7
+ data.tar.gz: '096fcdccb7fd896bee414dd23b2a7a8a166f9466f6e46f0e7e1bf17ef6557908f29f5fefb8bccc488b3f93b185a2a35d2eaec57d59ad481123e67e2fe7511395'
@@ -230,16 +230,26 @@ module Effective
230
230
  # Has Many
231
231
  def has_many(name, collection = nil, options = {}, &block)
232
232
  value(name).each_with_index do |object, index|
233
- builder = TableBuilder.new(object, template, options.merge(prefix: human_attribute_name(name).singularize + " ##{index+1}"))
233
+ builder = TableBuilder.new(object, template, options.reverse_merge(prefix: human_attribute_name(name).singularize + " ##{index+1}"))
234
234
  builder.render(&block)
235
235
  builder.rows.each { |child, content| rows["#{name}_#{child}_#{index}".to_sym] = content }
236
236
  end
237
237
  end
238
238
 
239
239
  def fields_for(name, object, options = {}, &block)
240
- builder = TableBuilder.new(object, template, options.merge(prefix: human_attribute_name(name)))
241
- builder.render(&block)
242
- builder.rows.each { |child, content| rows["#{name}_#{child}".to_sym] = content }
240
+ values = value(name)
241
+
242
+ if values.respond_to?(:each_with_index)
243
+ values.each_with_index do |object, index|
244
+ builder = TableBuilder.new(object, template, options.reverse_merge(prefix: human_attribute_name(name).singularize + " ##{index+1}"))
245
+ builder.render(&block)
246
+ builder.rows.each { |child, content| rows["#{name}_#{child}_#{index}".to_sym] = content }
247
+ end
248
+ else
249
+ builder = TableBuilder.new(object, template, options.merge(prefix: human_attribute_name(name)))
250
+ builder.render(&block)
251
+ builder.rows.each { |child, content| rows["#{name}_#{child}".to_sym] = content }
252
+ end
243
253
  end
244
254
  alias_method :effective_fields_for, :fields_for
245
255
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '1.15.4'.freeze
2
+ VERSION = '1.15.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.4
4
+ version: 1.15.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-21 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails