Sha256: 02932412ee9ec19d7d9a0393812f25e19303c322373045ed48c14a5ded44dcc5
Contents?: true
Size: 705 Bytes
Versions: 15
Compression:
Stored size: 705 Bytes
Contents
# frozen_string_literal: true module Decidim # The form object that handles the data behind updating a user's # interests in their profile page. class UserInterestScopeForm < Form mimic :scope attribute :name, JsonbAttributes attribute :checked, Boolean attribute :children, Array[UserInterestScopeForm] def map_model(model_hash) scope = model_hash[:scope] user = model_hash[:user] self.id = scope.id self.name = scope.name self.checked = user.interested_scopes_ids.include?(scope.id) self.children = scope.children.map do |children_scope| UserInterestScopeForm.from_model(scope: children_scope, user:) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems