# frozen_string_literal: true module CommunitiesHelper def options_for_communities communities = [OpenStruct.new(label: "", value: communities_path)] communities += @communities.map do |community| OpenStruct.new(label: "[#{community.community_id}] #{community.community_name}", value: edit_community_path(community.public_id)) end # Since the value is the route, we have to rebuild that to select it selected_community = edit_community_path(@community.public_id) if @community.present? options_from_collection_for_select(communities, :value, :label, selected_community) end end