lib/sojourn/event.rb in sojourn-0.1.1 vs lib/sojourn/event.rb in sojourn-1.0.0.pre
- old
+ new
@@ -1,11 +1,14 @@
require_relative 'serializers/indifferent_json'
module Sojourn
class Event < ActiveRecord::Base
- DEFAULT_FIELDS = %i(id sojourner_uuid name properties user_id created_at)
+ DEFAULT_FIELDS = [:id, :sojourner_uuid, :name, :properties, :sojourn_request_id, :user_id, :created_at]
+ belongs_to :request, foreign_key: :sojourn_request_id
belongs_to :user
+ has_one :campaign, through: :request
+ has_one :browser, through: :request
serialize :properties, Serializers::IndifferentJSON
before_save do
properties.keys.map(&:to_sym).each do |key|