Sha256: 35656464fcd04783ff2d2aca5a680d8524b99044e5d4a7b92b448fc7c9d1c574
Contents?: true
Size: 584 Bytes
Versions: 74
Compression:
Stored size: 584 Bytes
Contents
# frozen_string_literal: true module Decidim # The form object that handles the data behind creating a user group. class InviteUserToGroupForm < Form mimic :invite attribute :nickname, String validates :nickname, presence: true validate :user_exists def user @user ||= Decidim::User.find_by(nickname: clean_nickname, organization: current_organization) end private def clean_nickname nickname.to_s.tr("@", "") end def user_exists return true if user.present? errors.add :nickname, :invalid end end end
Version data entries
74 entries across 74 versions & 1 rubygems