masteringmodernpayments / book

Discussion group for Mastering Modern Payments
https://www.masteringmodernpayments.com
6 stars 2 forks source link

Discuss: State and History #6

Open peterkeen opened 10 years ago

peterkeen commented 10 years ago
ghost commented 9 years ago

cool to see a little example of using paper_trail and aasm!

FWIW, with Stripe API version 2015-02-18, sales model code needs to use charges.source instead of charge.card, i.e.

self.update(
        stripe_id: charge.id,
        card_expiration: Date.new(charge.source.exp_year, charge.source.exp_month, 1),
        fee_amount: balance.fee
      )
micahtaylor commented 9 years ago

Encountering some duplicate issues.

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::DuplicateColumn: ERROR:  column "stripe_id" of relation "sales" already exists
: ALTER TABLE "sales" ADD COLUMN "stripe_id" character varying(255)/Sites/sales/db/migrate/20150313210017_add_fields_to_sale.rb:4:in `change'
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR:  column "stripe_id" of relation "sales" already exists
: ALTER TABLE "sales" ADD COLUMN "stripe_id" character varying(255)
/Sites/sales/db/migrate/20150313210017_add_fields_to_sale.rb:4:in `change'
PG::DuplicateColumn: ERROR:  column "stripe_id" of relation "sales" already exists
/Sites/sales/db/migrate/20150313210017_add_fields_to_sale.rb:4:in `change'
ranska commented 9 years ago

in the example on the generate migration there is: stripe_id:string \ but is still defined on the Sale scaffold this line should probably removed ?

ranska commented 9 years ago

in 2nd version of Sale model validates_uniqueness_of :guid was removed is it for a specific reason or can we keep it.

peterkeen commented 9 years ago

@ranska keep the guid. The definitions are meant to be additive.

As far as the migration, that's correct. I'll remove that in the next version.