Skip to content

Commit

Permalink
show array on display_value
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Feb 5, 2025
1 parent 7f72e76 commit 4e0ecb1
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions lib/avo/fields/select_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ def options_for_select
def label
# If options are array don't need any pre-process
if options.is_a?(Array)
if @multiple
return value.join(", ")
else
return value
end
return @multiple ? value.join(", ") : value
end

# If options are enum and display_value is true we return the Value of that key-value pair, else return key of that key-value pair
Expand All @@ -59,13 +55,7 @@ def label

# When code arrive here it means options are Hash
# If display_value is true we only need to return the value stored in DB
if display_value
if @multiple
return value.join(", ")
else
return value
end
end
return value if display_value

if @multiple
options.select { |_, v| value.include?(v.to_s) }.keys.join(", ")
Expand Down

0 comments on commit 4e0ecb1

Please sign in to comment.