tansengming / stripe-rails

A Rails Engine for integrating with Stripe
MIT License
753 stars 123 forks source link

some problem with Turbo-rails (affects Rails 6.1) #208

Closed jasonfb closed 2 years ago

jasonfb commented 3 years ago

I think there's some problem when the format is :turbo_stream

the call to stripe_javascript_tag fails in this way

ActionView::Template::Error (Missing partial stripe/_js with {:locale=>[:en], :formats=>[:turbo_stream], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder, :haml]}. Searched in:
  * "/Users/jason/Work/Verso_Commerce/verso-commerce/app/views"
  * "/Users/jason/Work/hot-glue/app/views"
  * "/Users/jason/.rvm/gems/ruby-2.6.6/gems/stripe-rails-2.3.0/app/views"
  * "/Users/jason/.rvm/gems/ruby-2.6.6/gems/kaminari-core-1.2.1/app/views"
  * "/Users/jason/.rvm/gems/ruby-2.6.6/gems/devise-4.7.3/app/views"
  * "/Users/jason/.rvm/gems/ruby-2.6.6/gems/actiontext-6.1.3.1/app/views"
  * "/Users/jason/.rvm/gems/ruby-2.6.6/gems/actionmailbox-6.1.3.1/app/views"
):
    42:       gtag('config', 'UA-********-1');
    43: 
    44: 
    45:     = stripe_javascript_tag
    46: 
    47:     :javascript
    48:       VERSO.__stripe_pk = "#{Rails.configuration.stripe.publishable_key}"

app/views/layouts/application-dashboard.haml:45
** [Honeybadger] Unable to send error report: API key is missing. id=969fc15e-212a-4a45-90c0-e27c379560a9 level=3 pid=75648
tansengming commented 3 years ago

Hi @jasonfb , thanks for reporting this.

Unfortunately I have no plans to support turbo rails for now. Mostly because I have no time to research this at the moment. I am ignorant enough that I can't even say for sure that loading the Stripe JS through turbo stream is a good idea (at first glance ... I don't think it is?)

But I'll be happy to review a pull request if anyone else would like to have a go at it!