Sha256: c3d00f17cf1850491aab499eb9d822d69e35d469b81bfa7405be2cbd8b9d47c6
Contents?: true
Size: 892 Bytes
Versions: 3
Compression:
Stored size: 892 Bytes
Contents
module Chaskiq class Subscriber < ActiveRecord::Base has_many :subscriptions has_many :lists, through: :subscriptions, class_name: "Chaskiq::List" has_many :metrics , as: :trackable has_many :campaigns, through: :lists, class_name: "Chaskiq::Campaign" validates :email , presence: true validates :name , presence: true %w[click open bounce spam].each do |action| define_method("track_#{action}") do |opts| m = self.metrics.new m.assign_attributes(opts) m.action = action m.save end end def encoded_id URLcrypt.encode(self.email) end def decoded_id URLcrypt.decode(self.email) end def style_class case self.state when "passive" "plain" when "subscribed" "information" when "unsusbscribed" "warning" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chaskiq-0.0.6 | app/models/chaskiq/subscriber.rb |
chaskiq-0.0.5 | app/models/chaskiq/subscriber.rb |
chaskiq-0.0.4 | app/models/chaskiq/subscriber.rb |