Sha256: 109ff7d9f5459c229e894f36cd51d03d3908594e690b61ad7f9e0d1d187887b4
Contents?: true
Size: 572 Bytes
Versions: 72
Compression:
Stored size: 572 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: followable) end end end
Version data entries
72 entries across 72 versions & 1 rubygems