Sha256: 5f2dd15215e230415c913789bc6b21cdb5c41ffd583884627112f0a078022d43

Contents?: true

Size: 382 Bytes

Versions: 2

Compression:

Stored size: 382 Bytes

Contents

module Sojourn
  class Campaign < ActiveRecord::Base

    has_many :requests, foreign_key: :sojourn_campaign_id
    has_many :events, through: :requests

    class << self

      def from_request(request)
        return unless (request.tracked_params).any?
        where(params: request.tracked_params.to_param.try(:truncate, 2048)).first_or_initialize
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sojourn-1.0.0.pre2 lib/sojourn/campaign.rb
sojourn-1.0.0.pre lib/sojourn/campaign.rb