Skip to content

Commit

Permalink
unscoped_possibilities need to default to an empty array #2020
Browse files Browse the repository at this point in the history
  • Loading branch information
stuzart committed Oct 22, 2024
1 parent 90456c6 commit e1f9d99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/helpers/fancy_multiselect_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def set_defaults_with_reflection(association, object, options)
# get 'view' from :can_view?
access = required_access.to_s.split('_').last.delete('?')
association_class = options.delete(:association_class) || reflection.klass
options[:unscoped_possibilities] ||= authorised_assets(association_class, nil, access) if options[:other_projects_checkbox]
if options[:other_projects_checkbox] && options[:unscoped_possibilities].blank?
options[:unscoped_possibilities] = authorised_assets(association_class, nil, access)
end
options[:possibilities] ||= authorised_assets(association_class, current_user.person.projects, access)
if options[:sort_by]
attr = options[:sort_by]
Expand Down

0 comments on commit e1f9d99

Please sign in to comment.