class ApplicationFormSetting include Mongoid::Document include Mongoid::Timestamps field :reviewer_length, default: 3, :type=> Integer field :last_serial_number, :type => Integer, :default => 0 def self.get_one s = self.first s = self.create if s.nil? s end end