app/models/wco/log.rb in wco_models-3.1.0.106 vs app/models/wco/log.rb in wco_models-3.1.0.107
- old
+ new
@@ -4,15 +4,22 @@
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
store_in collection: 'wco_logs'
- field :message
+ field :label, type: :string
+ field :message, type: :string
- field :class_name
- field :object_id
+ belongs_to :obj, polymorphic: true, optional: true
- field :raw_json, type: Object, default: '{}'
-
has_and_belongs_to_many :tags
+ def self.puts! message, label, obj: nil
+ create( message: message, label: label, obj: obj )
+ puts "+++ +++ #{label}:"
+ puts message.inspect
+ end
+
+ def to_s
+ "#{created_at} #{message}"
+ end
end