Skip to content

Instantly share code, notes, and snippets.

@gambala gambala/admin.slim
Created Jul 24, 2017

Embed
What would you like to do?
Redis::Objects use case
p = user.ip_addresses.size
p = user.ip_addresses.value
class ApplicationController < ActionController::Base
before_action :store_ip_addresses
def store_ip_addresses
return unless user_signed_in?
current_user.ip_addresses << request.ip
end
end
class User < ApplicationRecord
include Redis::Objects
set :ip_addresses
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.