Sha256: 9e44595e7995ad919f898b3a24097fa687c855da61213d427e41f578e8ff4b43

Contents?: true

Size: 575 Bytes

Versions: 10

Compression:

Stored size: 575 Bytes

Contents

class CanceledAccount < ActiveRecord::Base
  attr_accessor :account

  belongs_to :plan

  before_validation :populate_from_account, :on => :create, :if => :account

  private

  def populate_from_account
    self.name          = account.name
    self.keyword       = account.keyword
    self.billing_email = account.customer.email
    self.memberships   = account.memberships.to_json(:include => { :user => { :only => [:email, :name, :created_at]}}, :only => [:admin, :created_at])
    self.plan          = account.plan
    self.started_at    = account.created_at
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
saucy-0.15.0 app/models/canceled_account.rb
saucy-0.14.5 app/models/canceled_account.rb
saucy-0.14.3 app/models/canceled_account.rb
saucy-0.14.2 app/models/canceled_account.rb
saucy-0.14.1 app/models/canceled_account.rb
saucy-0.14.0 app/models/canceled_account.rb
saucy-0.13.3 app/models/canceled_account.rb
saucy-0.13.2 app/models/canceled_account.rb
saucy-0.13.1 app/models/canceled_account.rb
saucy-0.13.0 app/models/canceled_account.rb