Sha256: f732e2e781a1f2d7d415a77b21cded3211ec76f10fae829ddba8dffb8fe07c66
Contents?: true
Size: 699 Bytes
Versions: 38
Compression:
Stored size: 699 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, String 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
38 entries across 38 versions & 1 rubygems