about summary refs log tree commit diff stats
path: root/app/models/global.rb
blob: 7c7d6d43e469f61509f14ac1de5c3155e7beeb47 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Global < ApplicationRecord
  def self.get_filtered_comments
    row = find_by_key("filtered_comments")
    if row
      row[:int_value]
    else
      0
    end
  end

  def self.increment_filtered_comments
    row = find_by_key("filtered_comments")
    if row
      row.int_value += 1
      row.save
    else
      create(key: "filtered_comments", int_value: 1)
    end
  end
end