module BetterCallRedis::ActiveRecord
Public Class Methods
included(base)
click to toggle source
# File lib/better_call_redis/active_record.rb, line 4 def self.included(base) base.extend(ClassMethods) end
Private Instance Methods
better_call_redis_logically_delete()
click to toggle source
# File lib/better_call_redis/active_record.rb, line 18 def better_call_redis_logically_delete return if self.new_record? return unless common_deleted_attribute = self.class.better_call_redis_common_deleted_attribute return unless self.send("#{common_deleted_attribute}_changed?") self.send("#{common_deleted_attribute}") ? better_call_redis_notify_redis_removed : better_call_redis_notify_redis_created end
better_call_redis_notify(action)
click to toggle source
# File lib/better_call_redis/active_record.rb, line 25 def better_call_redis_notify(action) self.class.better_call_redis_configuration.redis.publish(self.class.better_call_redis_configuration.namespace, {:class_name => self.class.name, :message => action}.to_json) end
better_call_redis_notify_redis_created()
click to toggle source
# File lib/better_call_redis/active_record.rb, line 10 def better_call_redis_notify_redis_created better_call_redis_notify(1) end
better_call_redis_notify_redis_removed()
click to toggle source
# File lib/better_call_redis/active_record.rb, line 14 def better_call_redis_notify_redis_removed better_call_redis_notify(-1) end