Sha256: 8bbb24ddad488063cae38a9e8594d00750dd8fd6233cd407437a38ae1a00a396
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
module Socialization module Stores module Mixins module Like public def touch(what = nil) if what.nil? @touch || false else raise ArgumentError unless [:all, :liker, :likeable, false, nil].include?(what) @touch = what end end def after_like(method) raise ArgumentError unless method.is_a?(Symbol) || method.nil? @after_create_hook = method end def after_unlike(method) raise ArgumentError unless method.is_a?(Symbol) || method.nil? @after_destroy_hook = method end protected def call_after_create_hooks(liker, likeable) self.send(@after_create_hook, liker, likeable) if @after_create_hook touch_dependents(liker, likeable) end def call_after_destroy_hooks(liker, likeable) self.send(@after_destroy_hook, liker, likeable) if @after_destroy_hook touch_dependents(liker, likeable) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
socialization-0.5.0.beta4 | lib/socialization/stores/mixins/like.rb |
socialization-0.5.0.beta3 | lib/socialization/stores/mixins/like.rb |