Sha256: 8394893ef0661278dec2a608d88105601acae4fac4fca3ed0fb1c50f819134e6
Contents?: true
Size: 647 Bytes
Versions: 7
Compression:
Stored size: 647 Bytes
Contents
module Janus module Models module Base extend ActiveSupport::Concern module ClassMethods def generate_token(column_name, size = 32) loop do token = SecureRandom.hex(size) return token unless where(column_name => token).any? end end def janus_config(*keys) keys.each do |key| class_eval <<-EOV def self.#{key} @#{key} || Janus::Config.#{key} end def self.#{key}=(value) @#{key} = value end EOV end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems