diff --git a/lib/avo/photo_object.rb b/lib/avo/photo_object.rb index 4a8590f7e4..4dcbc190ef 100644 --- a/lib/avo/photo_object.rb +++ b/lib/avo/photo_object.rb @@ -49,8 +49,6 @@ def visible_on_new? = visible_in_either?(:new, :forms) private def visible_in_either?(*options) - options.map do |option| - visible_on.include?(option) - end.uniq.first.eql?(true) + options.intersection(visible_on).present? end end diff --git a/spec/dummy/app/avo/resources/event.rb b/spec/dummy/app/avo/resources/event.rb index 368ccffff5..0d2301a91f 100644 --- a/spec/dummy/app/avo/resources/event.rb +++ b/spec/dummy/app/avo/resources/event.rb @@ -32,8 +32,8 @@ def fields foo: :bar, } - field :profile_photo, as: :file, is_image: true - field :cover_photo, as: :file, is_image: true + field :profile_photo, as: :file, is_image: true, only_on: :forms + field :cover_photo, as: :file, is_image: true, only_on: :forms if params[:show_location_field] == "1" # Example for error message when resource is missing