about summary refs log tree commit diff stats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/global.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/global.rb b/app/models/global.rb new file mode 100644 index 0000000..7c7d6d4 --- /dev/null +++ b/app/models/global.rb
@@ -0,0 +1,20 @@
1class Global < ApplicationRecord
2 def self.get_filtered_comments
3 row = find_by_key("filtered_comments")
4 if row
5 row[:int_value]
6 else
7 0
8 end
9 end
10
11 def self.increment_filtered_comments
12 row = find_by_key("filtered_comments")
13 if row
14 row.int_value += 1
15 row.save
16 else
17 create(key: "filtered_comments", int_value: 1)
18 end
19 end
20end