fluke/devops-service/db/mongo/models/statistic.rb

28 lines
548 B
Ruby
Raw Permalink Normal View History

2018-04-04 22:44:39 +03:00
require "mongoid"
module Devops
module Model
class Statistic
include ::Mongoid::Document
include ::Mongoid::Timestamps::CreatedInt
include ::ActiveModel::Validations
store_in collection: "statistic"
field :user, type: String
field :path, type: String
field :method, type: String
field :body, type: String
field :response_code, type: Integer
def to_hash
hash = self.attributes.clone
hash["id"] = hash.delete("_id").to_s
hash
end
end
end
end