active_scaffold 3.6.12 → 3.6.14

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: c7e719c9e6003904fa2f7765e1f5d5c2dc691fe6fe662bd07277e056f304c597
4
- data.tar.gz: b2901dfbd786c90000ba12970baa056324caefc60810c8883166b47abf7079ec
3
+ metadata.gz: 79509054cd67e6f4f1313ed2ee14a1f9eb64306cfbc3e20f5385af23f44edc90
4
+ data.tar.gz: 2490e6858effd4cb04634f8bebf868318dc807ef01cc3f1b7f9b4b34652f2f9f
5
5
  SHA512:
6
- metadata.gz: 0e020933f2fa31d3922a0066cac2bf85c00be4f1424a4bbd6b7544e472af3e7c5f2896290d0bc270af943a4137cbfe937ddee349efa97d8df328f0e1954eba45
7
- data.tar.gz: acef80c0ff55cd921a72b52384514e05106eb4c842fcd5fad942e952513586fad8f3e79f805e52cf83e9254676ea221efc0877f88b9ad822af82717759014f8b
6
+ metadata.gz: 5719da364b955e1fce7c1f1e7fc383a4ada1313a69334c6bfddfc1960a1960d5aa05ed6b6054d7eba52390d7b70984930b84dc06162d96ffca01565c15dacbd4
7
+ data.tar.gz: cc9ed4db3c9c24b741a2fee4ee1f38dfa636ea607190c66b0d2e9fb99685b542bda602093945427defc47c22a24f726503e017ab65c17e03b3b63d093a29e461
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ - Fix setting data on html_options when threadsafe is enabled
2
+ - Fill nested association on render field, as done in new action
3
+
4
+ = 3.6.13
5
+ - Fix link caching on action when threadsafe is enabled
6
+
1
7
  = 3.6.12
2
8
  - Fix getting proxy for action link when iterating over action links and threadsafe is enabled, so link can be changed
3
9
 
@@ -92,12 +92,14 @@ module ActiveScaffold::Actions
92
92
  record = new_model
93
93
  copy_attributes(saved_record, record) if saved_record
94
94
  apply_constraints_to_record(record) unless scope
95
+ create_association_with_parent record, true if nested?
95
96
  update_record_from_params(record, columns, attributes || {}, true)
96
97
  end
97
98
 
98
99
  def updated_record_with_column(column, value, scope)
99
100
  record = params[:id] ? copy_attributes(find_if_allowed(params[:id], :read)) : new_model
100
101
  apply_constraints_to_record(record) unless scope || params[:id]
102
+ create_association_with_parent record, true if nested?
101
103
  value = column_value_from_param_value(record, column, value)
102
104
  record.send "#{column.name}=", value
103
105
  record.id = params[:id]
@@ -124,8 +124,9 @@ module ActiveScaffold::Actions
124
124
  nested.child_association && nested_parent_record
125
125
  end
126
126
 
127
- def create_association_with_parent(record)
127
+ def create_association_with_parent(record, check_match = false)
128
128
  return unless create_association_with_parent?
129
+ return if check_match && !nested.match_model?(active_scaffold_config.model)
129
130
  if nested.child_association.singular?
130
131
  record.send("#{nested.child_association.name}=", nested_parent_record)
131
132
  elsif nested.association.through_singular? && nested.child_association.through_singular?
@@ -13,9 +13,7 @@ module ActiveScaffold::Actions
13
13
  parent_record = new_model
14
14
  # don't apply if scope, subform inside subform, because constraints won't apply to parent_record
15
15
  apply_constraints_to_record parent_record unless @scope
16
- if nested? && nested.match_model?(active_scaffold_config.model)
17
- create_association_with_parent parent_record
18
- end
16
+ create_association_with_parent parent_record, true if nested?
19
17
  parent_record
20
18
  end
21
19
 
@@ -167,10 +167,10 @@ module ActiveScaffold
167
167
 
168
168
  def cached_action_link_url(link, record)
169
169
  @action_links_urls ||= {}
170
- @action_links_urls[link.name_to_cache] || begin
170
+ @action_links_urls[link.name_to_cache.to_s] || begin
171
171
  url_options = cached_action_link_url_options(link, record)
172
172
  if cache_action_link_url?(link, record)
173
- @action_links_urls[link.name_to_cache] = url_for(url_options)
173
+ @action_links_urls[link.name_to_cache.to_s] = url_for(url_options)
174
174
  else
175
175
  url_options.merge! eid: nil, embedded: nil if link.nested_link?
176
176
  url_for(params_for(url_options))
@@ -207,7 +207,7 @@ module ActiveScaffold
207
207
 
208
208
  def action_link_url(link, record)
209
209
  url = replace_id_params_in_action_link_url(link, record, cached_action_link_url(link, record))
210
- url = add_query_string_to_cached_url(link, url) if @action_links_urls[link.name_to_cache]
210
+ url = add_query_string_to_cached_url(link, url) if @action_links_urls[link.name_to_cache.to_s]
211
211
  url
212
212
  end
213
213
 
@@ -267,10 +267,10 @@ module ActiveScaffold
267
267
 
268
268
  def cached_action_link_url_options(link, record)
269
269
  @action_links_url_options ||= {}
270
- @action_links_url_options[link.name_to_cache] || begin
270
+ @action_links_url_options[link.name_to_cache.to_s] || begin
271
271
  options = action_link_url_options(link, record)
272
272
  if cache_action_link_url_options?(link, record)
273
- @action_links_url_options[link.name_to_cache] = options
273
+ @action_links_url_options[link.name_to_cache.to_s] = options
274
274
  end
275
275
  options
276
276
  end
@@ -335,6 +335,7 @@ module ActiveScaffold
335
335
  html_options[:method] = link.method if link.method != :get
336
336
 
337
337
  html_options[:data] ||= {}
338
+ html_options[:data] = html_options[:data].deep_dup if html_options[:data].frozen?
338
339
  html_options[:data][:confirm] = link.confirm(h(record&.to_label)) if link.confirm?
339
340
  if !options[:page] && !options[:popup] && (options[:inline] || link.inline?)
340
341
  html_options[:class] << ' as_action'
@@ -378,7 +379,7 @@ module ActiveScaffold
378
379
  end
379
380
  end
380
381
  id ||= record&.id&.to_s || (nested? ? nested_parent_id.to_s : '')
381
- action_link_id = ActiveScaffold::Registry.cache :action_link_id, link.name_to_cache do
382
+ action_link_id = ActiveScaffold::Registry.cache :action_link_id, link.name_to_cache.to_s do
382
383
  action_id = "#{id_from_controller("#{link.controller}-") if params[:parent_controller] || (link.controller && link.controller != controller.controller_path)}#{link.action}"
383
384
  action_link_id(action_id, '--ID--')
384
385
  end
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 6
5
- PATCH = 12
5
+ PATCH = 14
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.12
4
+ version: 3.6.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-22 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails