Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/activeadmin/resource_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ def json_editor
object.nested_attributes_options.keys.each {|_nested_key|
nested_attributes_with_index = params[resource_request_name]["#{_nested_key}_attributes"]
next if nested_attributes_with_index.nil?
nested_klass = _nested_key.to_s.singularize.camelize.constantize
nested_klass = object.class.reflect_on_association(_nested_key).class_name.constantize
nested_klass.columns_hash.select { |_key, attr| attr.type.in? [:json, :jsonb] }.keys.each do |key|
nested_attributes_with_index.each {|_index, nested_attributes|
next unless nested_attributes.respond_to?(:key)
next unless nested_attributes.key? key
json_data = nested_attributes[key]
data = if json_data == 'null' || json_data.blank?
Expand Down