Sha256: 4a18a40079a8eec1f280676880a47c0df571c598234434194882a4de907e70ee
Contents?: true
Size: 708 Bytes
Versions: 8
Compression:
Stored size: 708 Bytes
Contents
# frozen_string_literal: true module Decidim # The form object that handles the data behind updating a user's # interests in her 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
8 entries across 8 versions & 1 rubygems