Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:48:58+00:00 2026-06-16T13:48:58+00:00

Rails newb here, so add as much detail to the answer as you would

  • 0

Rails newb here, so add as much detail to the answer as you would like and feel free to tell me I’m doing it wrong.

Context: I’m building a SaaS rails app and plan to add stripe (payment) integration soon. I would like to build out the functionality that differentiates the various account types (subscription plans) before I integrate stripe.

I’m using many if / else statements through out the app depending on account type (e.g., free, level 1, level 2) to show / hide appropriate functionality to the user. My basic statements look like this:

<% if current_user.account_level == "1" %>
    your account level is 1
<% elsif current_user.account_level == "2" %>
    your account level is 2
<% else %>

<% end %>

This assumes I’m keeping record of what “account level” the user has in the user model (or some other model). Is this the appropriate place to do so? Technically, Stripe has the most current data (i.e. if the card canceled the account level would be different). Should I be using the Stripe api directly to determine account level? It seems like I should have record of that somewhere in my data.

Are there any other best practices I should keep in mind while developing knowing that I’ll be integrating Stripe in the future?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:49:00+00:00Added an answer on June 16, 2026 at 1:49 pm

    While you’re right that Stripe will store the latest data, I would recommend maintaining a local cache of anything you’ll use frequently (like the subscription state).

    There are two main approaches you might use to make sure your database has the latest state:

    • In your code that makes API calls to Stripe, be sure you’re also updating your local copy, or

    • Use our webhooks to listen for events related to your customers (e.g., customer.subscription.updated). By doing this, you can be sure your local database always matches up with Stripe – even if you change your customer’s plan via the dashboard, your webhook endpoint will receive the update.

    The primary benefit to storing this data locally is speed: you most likely don’t want your customers waiting on an API call for each request that accesses this data, especially since it seems that you need it throughout your website.

    You will want to make sure you’re storing the customer ID in your database so that you can match up the Stripe customer with your local user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rails noob here so I'm not sure what I'm doing wrong. We're replacing a
Newb RoR developer here, standing at the finish line of my first paying Rails
first time poster - semi-newb to Rails. Here is my question. Suppose you have
Rails Newb here asking his first question.... I'm building a personal blog-style website that
I'm a newb to RoR. I'm using the book Agile Web Development with Rails
Rails 3 noob here. Currently the code in my controller below is getting the
Rails and ActiveRecord do a perfectly nice job of dealing with what I would
Rails newb question: Say I'm currently viewing the show.html for one of my classes(
Rails 3 appears to automatically truncate production logs after some unknown period. I would
While I'm not a complete Ruby/Rails newb, I'm still pretty green and I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.