class MasterPassword include Mongoid::Document include Mongoid::Timestamps include ActiveModel::SecurePassword field :password_digest, type: String has_secure_password def changed_days_ago ((Time.now - self.updated_at) / 86400).to_i end end