Sha256: ba30bfa20997915404a7f5870d35837865bad1b2bd08ff98c4e5d9712a30ca8a
Contents?: true
Size: 710 Bytes
Versions: 12
Compression:
Stored size: 710 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: user) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems