Fatumata Jalloh
Joined
Activity
I recently added Hotwire to my rails app to update modals but this broke a link_to I had that redirected users to stripe. I looked online for ways to work around it but since Hotwire is relatively new, I couldn't find it. Does anyone have any recommendations on getting link_to to work with turbo stream?
I am currently on the part where you add
<% if params[:price]==bucket["key"].to_s%>
<%= link_to bucket["key"], request.params.except(:price)%>
<% else %>
<%= link_to bucket["key"], request.params.merge(price: bucket["key"]) %>
<%end%>
but I get an error:
undefined method `merge' for []:Array
Extracted source (around line #28):
@producs = Product.search "*", where: args, aggs: {category_id: {}, price: {}, condition: {}, created_at:{}}
I've looked online but I don't see any sources for it. I would really appreciate any help!
Thank you for this! I am currently on the part where you add <% if params[:price]==bucket["key"].to_s%>
<%= link_to bucket["key"], request.params.except(:price)%>
<br>
<% else %>
<%= link_to bucket["key"], request.params.merge(price: bucket["key"]) %>
<%end%> but I get an error:
undefined method `merge' for []:Array
Extracted source (around line #28):
@producs = Product.search "*", where: args, aggs: {category_id: {}, price: {}, condition: {}, created_at:{}}
end
I've looked online but I don't see any sources for it. Did anyone else get this error?
Posted in Stripe connect issues
It worked. Thank you!
Posted in Stripe connect issues
thank you !
Using accountLink, how would I be able to connect this back to the current user? Would I still be able to do current_user.stripe_user_id?
Posted in Stripe connect issues
I am currently working on integrating stripe connect to my app but it isn't working. I don't get any errors when I run it and it asks me to create an account and redirects back to the website but when I check my stripe dashboard, it doesn't show any added accounts. Any help would be appreciated! I looked over their documentation and copied that but I got the same results.
Here is some of my code:
class StripeController < ApplicationController
def connect
response = HTTParty.post("https://connect.stripe.com/oauth/token",
query: {
client_secret: ENV["STRIPE_SECRET_KEY"],
code: params[:code],
grant_type: "authorization_code"
}
)
if response.parsed_response.key?("error")
redirect_to welcome_path,
notice: response.parsed_response["error_description"]
else
stripe_user_id = response.stripe_user_id
current_user.stripe_user_id = stripe_user_id
redirect_to mypage_path,
notice: 'User successfully connected with Stripe!'
end
end
end
module UsersHelper
def stripe_button_link
stripe_url = "https://connect.stripe.com/express/oauth/authorize"
redirect_uri = stripe_connect_url
client_id = ENV["STRIPE_CLIENT_ID"]
"#{stripe_url}?response_type=code&redirect_uri=#{redirect_uri}&client_id=#{client_id}&scope=read_write"
end
end
<% if current_user.stripe_user_id %>
<%= link_to "Go to Stripe Dashboard", stripe_dashboard_path(current_user.id) %>
<% else %>
<%= link_to image_tag("ConnectwithStripe.png", width:"120px", height:"40px"), stripe_button_link %>
<% end %>