Sha256: 8d5e961147037e57b1e2ee30d43eef32f51c068a977408ff9661d4335b38cabb
Contents?: true
Size: 719 Bytes
Versions: 94
Compression:
Stored size: 719 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # A form object used to officialize users from the admin dashboard. class OfficializationForm < Form include TranslatableAttributes translatable_attribute :officialized_as, String attribute :user_id, Integer validates :officialized_as, length: { maximum: 300 } validates :user, presence: true, if: ->(form) { form.user_id.present? } def map_model(user) self.officialized_as = user.officialized_as self.user_id = user.id end def user @user ||= Decidim::User.find_by( id: user_id, organization: current_organization ) end end end end
Version data entries
94 entries across 94 versions & 1 rubygems