lib/socialization/actors/commenter.rb
# Toggles a {Comment comment} relationship.
#
# @param [Commentable] commentable the object to comment/uncomment.
# @return [Boolean]
Toggles a {Comment comment} relationship.
Toggles a { Comment comment } relationship .
def toggle_comment!(commentable, opts = {})
        raise Socialization::ArgumentError, "#{commentable} is not commentable!" unless commentable.respond_to?(:is_commentable?) && commentable.is_commentable?
        if comments?(commentable)
          uncomment!(commentable)
          false
        else
          comment!(commentable, opts)
          true
        end
      end
def toggle_comment! ( commentable , opts = { } ) raise Socialization :: ArgumentError , "#{commentable} is not commentable!" unless commentable . respond_to? ( :is_commentable? ) && commentable . is_commentable? if comments? ( commentable ) uncomment! ( commentable ) false else comment! ( commentable , opts ) true end end
Toggles a {Comment comment} relationship.
Toggles a { Comment comment } relationship .
None
Boolean
commentable
opts
commentable the object to comment/uncomment.
commentable the object to comment / uncomment .