Class: User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/caishu_model2/user.rb

Class Method Summary collapse

Class Method Details

.getTableName(key) ⇒ Object



9
10
11
12
# File 'lib/caishu_model2/user.rb', line 9

def self.getTableName(key)
  las = Zlib::crc32(key.to_s).to_i.to_s
  return "users#{las[0]}"
end

.next_idObject



25
26
27
28
29
# File 'lib/caishu_model2/user.rb', line 25

def self.next_id
  key = 'user_next_id'
  REDIS.incr(key)
  REDIS.get(key)
end

.setTableName(key) ⇒ Object



4
5
6
7
# File 'lib/caishu_model2/user.rb', line 4

def self.setTableName(key)
  self.table_name = self.getTableName(key)
   self
end