Skip to content

Commit

Permalink
fix: updatable row inputs (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Jul 4, 2023
1 parent 84c5f11 commit 092fb4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/avo/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def model_params
end

def permitted_params
@resource.get_field_definitions.select(&:updatable).map(&:to_permitted_param).concat extra_params
@resource.get_field_definitions.select(&:updatable).map(&:to_permitted_param).concat(extra_params).uniq
end

def extra_params
Expand Down
6 changes: 5 additions & 1 deletion lib/avo/concerns/has_fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def fields(only_root: false)
if item.is_field?
fields << item
end

if item.is_row?
fields << extract_fields_from_items(tab)
end
end

fields.flatten
Expand All @@ -117,7 +121,7 @@ def extract_fields_from_items(thing)
thing.items.each do |item|
if item.is_field?
fields << item
elsif item.is_panel?
elsif item.is_panel? || item.is_row?
fields << extract_fields_from_items(item)
end
end
Expand Down

0 comments on commit 092fb4a

Please sign in to comment.