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