early-leather-2501
01/23/2024, 3:51 PMloud-jewelry-99127
01/23/2024, 3:53 PMloud-jewelry-99127
01/23/2024, 3:53 PMearly-leather-2501
01/23/2024, 3:53 PMearly-leather-2501
01/23/2024, 3:56 PMdef fields
field :active_memberships, as: :belongs_to
end
This gives me a select box of all Membership record. Not associated to the accountloud-jewelry-99127
01/23/2024, 3:57 PMAvo::Resources::Membership on the search query, when the search is made from the action i think there is some params that indicates itloud-jewelry-99127
01/23/2024, 3:57 PMloud-jewelry-99127
01/23/2024, 3:58 PMearly-leather-2501
01/23/2024, 4:01 PMloud-jewelry-99127
01/23/2024, 4:09 PMvia_reflection_class=="Account" && via_parent_resource_id == nil && via_parent_resource_class == nil do query.where(account: params[:via_reflection_id]) before applying the ransack searchloud-jewelry-99127
01/23/2024, 4:09 PMloud-jewelry-99127
01/23/2024, 4:10 PMfetch_values_from where you implement a custom enpoint, you pass all what you need as param to that endpoint and return the wanted collection https://docs.avohq.io/3.0/fields/tags.html#fetch_values_fromloud-jewelry-99127
01/23/2024, 4:12 PMrecord using computed optionsloud-jewelry-99127
01/23/2024, 4:12 PMloud-jewelry-99127
01/23/2024, 4:13 PMloud-jewelry-99127
01/23/2024, 4:13 PMearly-leather-2501
01/23/2024, 4:49 PMfield :new_owner, as: :select, options: -> { record.active_memberships.includes(:user).where.not(role: 'owner').map {|membership| [membership.user.email, membership.id]} }loud-jewelry-99127
01/23/2024, 4:54 PM