Skip to content

Instantly share code, notes, and snippets.

@raphaelcm
Created October 3, 2012 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raphaelcm/3829933 to your computer and use it in GitHub Desktop.
Save raphaelcm/3829933 to your computer and use it in GitHub Desktop.
persistence bug repro case
class PersistenceTest
include Mongoid::Document
include Mongoid::Timestamps
BRAINTREE_SYNC_STATUSES = %w(new synced changed)
#
# Top-level Fields
#
field :terms_accepted_at, :type => DateTime
field :first_billing_date, :type => Date
field :next_billing_date, :type => Date
field :trial_duration, :type => Integer, :default => 0
field :charge_attempts, :type => Integer, :default => 0
field :migrated_pmt, :type => String
field :pre_coins_hub, :type => Boolean, :default => false
field :braintree_billing, :type => Boolean, :default => true
field :sync_status, :type => String, :default => "new"
field :reminder_sent, :type => Boolean, :default => false
field :override_amount, :type => Integer
field :terms_accepted_at, :type => DateTime
field :activated_at, :type => DateTime
#
# Validations
#
validates_inclusion_of :sync_status, :in => BRAINTREE_SYNC_STATUSES
def created_in_braintree?
self.sync_status != "new"
end
def synced?
self.sync_status == "synced"
end
def changed?
self.sync_status == "changed"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment