Add ActiveRecord, customer dashboard, separate DB architecture
- Re-enable ActiveRecord pointing at Neon Postgres - Add Customer model with stripe_customer_id, email, slug, status - Add dashboard controller and Apple ID-style device view - Redirect checkout success to /dashboard - Webhook now calls /instances, parses response, creates Customer in Rails DB - Add MIT License Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f4fe6b2074
commit
fd2d498141
16 changed files with 199 additions and 89 deletions
14
app/controllers/dashboard_controller.rb
Normal file
14
app/controllers/dashboard_controller.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class DashboardController < ApplicationController
|
||||
def show
|
||||
if params[:session_id].present?
|
||||
stripe_session = Stripe::Checkout::Session.retrieve(params[:session_id])
|
||||
@customer = Customer.find_by(stripe_customer_id: stripe_session.customer)
|
||||
elsif params[:email].present?
|
||||
@customer = Customer.find_by(email: params[:email])
|
||||
else
|
||||
redirect_to root_path
|
||||
end
|
||||
rescue Stripe::StripeError
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue