Open peterkeen opened 10 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
)
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'
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 ?
in 2nd version of Sale model
validates_uniqueness_of :guid
was removed is it for a specific reason or can we keep it.
@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.