Zach
Joined
Activity
Hey Chris,
How would you set up the controller for multiple prices? I'm currently creating 8 sessions for 4 monthly and 4 yearly prices, but it takes a while to load the page and I don't know that i need to call Stripe 8 times when only one price will be chosen by the user.
Are you using Rails in API mode? If so, this might help:
https://github.com/omniauth/omniauth#integrating-omniauth-into-your-rails-api
I'm an idiot. I was putting my credentials in the production file and not using the --environment development flag. So I was trying to authenticate w/ the twitter api with no credentials.
I'm having the OAuth::Unauthorized 400 Bad Request. None of the suggestions here work.
I do notice that the omniauth-twitter gem has a dependency of omniauth-oauth 1.1 but when using omniauth 2.0, the omniauth-oauth version is bumped to 1.2
I wonder if this version mismatch causes issues with how the omniauth-twitter gem makes calls.
Looking for help from anybody who has gotten the request to work.
Hey Tom, i've been fighting this for a day or two. Which babel config file are you using? The one from Chris's code or the one from the Uppy tutorial?
Aha! I fixed this by overriding this method in my ApplicationController with the following:
def after_sign_out_path_for(resource_or_scope)
scope = Devise::Mapping.find_scope!(resource_or_scope)
router_name = Devise.mappings[scope].router_name
context = router_name ? send(router_name) : self
context.respond_to?(:root_url) ? context.root_url(:host => request.domain) : "/"
end
Note the root_url(:host => request.domain) piece. Apparently root_url(:subdomain => false) doesn't exist. Find more discussion here: https://github.com/rails/rails/issues/2025
So i'm using Devise for authentication and i've got everything working for signing up and signing in, but i need some help with signing out.
There's a 'home' controller and view that is the landing page for unauthenticated users at 'lvh.me:3000' and then there's a 'dashboards' controller and view that becomes the root path for a user who is signed in. They sign in, hit a before_action in my ApplicationController, get redirected to 'test.lvh.me:3000' where 'test' is the subdomain for the account, and see the dashboard page.
Here's my before_action to redirect once they're logged in:
def redirect_to_subdomain
return unless user_signed_in?
if request.subdomain.blank?
if current_user.accounts.exists?
redirect_to root_url(subdomain: current_user.accounts.first.subdomain)
end
else
unless current_user.accounts.pluck(:subdomain).include?(request.subdomain)
redirect_to root_url(subdomain: current_user.accounts.first.subdomain)
end
end
end
When they sign out, I want them to have their session destroyed (obviously) and then have them sent back to 'lvh.me:3000'. Currently, they sign out, the session gets destroyed (i can see the button text change and the account name disappear from the nav), but the URL remains 'test.lvh.me:3000'. I see that Devise's default sign out path helper is:
def after_sign_out_path_for(resource_or_scope)
scope = Devise::Mapping.find_scope!(resource_or_scope)
router_name = Devise.mappings[scope].router_name
context = router_name ? send(router_name) : self
context.respond_to?(:root_path) ? context.root_path : "/"
end
Is there some way to override this? My assumption here is that because Devise uses root_path instead of root_url, it's not taking the subdomain off of the route. Any thoughts on how to achieve what I want?