title: How to save customer card updates in Stripe, Rails?
body: <p>I want customers to be able to update their credit card details in my Rails app.  Stripe has documentation on how to achieve this, but the article is showing an example in PHP, but I need an example for Rails: <a href="https://stripe.com/docs/recipes/updating-customer-cards" rel="nofollow noreferrer">https://stripe.com/docs/recipes/updating-customer-cards</a></p>
  
  <p>Basically, I need to save a customer's credit card without charging it.</p>
  
  <p>This is <code>subscribers_controller.rb</code>:</p>
  
  <pre><code>class SubscribersController &lt; ApplicationController        
    before_filter :authenticate_user!
  
    def new
    end
  
    def update
      token = params[:stripeToken]
  
      customer = Stripe::Customer.create(
        card: token,
        plan: 1212,
        email: current_user.email
      )
  
      current_user.subscribed = true
      current_user.stripeid = customer.id
      current_user.save
  
      redirect_to profiles_user_path
    end
  end
  </code></pre>