Class: Useraction
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Useraction
show all
- Defined in:
- app/models/useraction.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.create(params) ⇒ Object
8
9
10
11
|
# File 'app/models/useraction.rb', line 8
def self.create(params)
self.name.constantize.send(:expired).each { |u| u.destroy }
super
end
|
.current ⇒ Object
13
14
15
|
# File 'app/models/useraction.rb', line 13
def self.current
eval("Useraction#{current_index}")
end
|
.date_of_index(i) ⇒ Object
if current index = 2
i days before today
0 2
1 1
2 0
3 4
4 3
29
30
31
|
# File 'app/models/useraction.rb', line 29
def self.date_of_index(i)
Time.zone.now.to_date.advance(:days => -((current_index - i)%5))
end
|
.date_range ⇒ Object
17
18
19
20
|
# File 'app/models/useraction.rb', line 17
def self.date_range
t = Time.zone.now.to_date
t.advance(:days => -4) .. t
end
|
Instance Method Details
#params_truncated ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/models/useraction.rb', line 33
def params_truncated
if params.to_s.size > 80
p = params.to_s[0..80]+" ...more"
else
p = params.to_s
end
p.gsub(/^\{|\}$/,"") end
|