Sha256: 0ba8640f82ffbfa98016a7ef2d49071b8cf3c6b33d295ccd462c815a9284b0bb
Contents?: true
Size: 561 Bytes
Versions: 18
Compression:
Stored size: 561 Bytes
Contents
# frozen_string_literal: true module Decidim # A form object to be used when users want to follow a followable resource. class FollowForm < Decidim::Form mimic :follow attribute :followable_gid, String validates :followable_gid, :followable, presence: true validates :followable, exclusion: { in: ->(form) { [form.current_user] } } def followable @followable ||= GlobalID::Locator.locate_signed followable_gid end def follow @follow ||= Decidim::Follow.find_by(user: current_user, followable:) end end end
Version data entries
18 entries across 18 versions & 1 rubygems