Chris Oliver

Joined

291,200 Experience
86 Lessons Completed
299 Questions Solved

Activity

I didn't comment out ActiveRecord so that's why I never had that error.

Looks like you're missing part of disabling ActiveRecord in your config files or something. I'd go through one of those instruction sets again and see if you missed anything: http://stackoverflow.com/a/...

Yeah so I would start adding byebug into the reserve method to figure out which branch it's going down when it fails, and which things you thought were working but aren't. Then you can figure out what inputs you're giving it that don't work.

Put a byebug into the Stripe charge section only, you'll know if it gets to that, you are in the right branch. Then you can use byebug to run the charge in the console to see if it succeeds or fails.

You'd want a stripe_charge_id column (as string) on your booking. The charge object is just the result of the Stripe charge, not your record. That's just saving the reference for everything.

The other thing to check is are your charges showing up in the Stripe test dashboard?

Oh yeah, I realized I made a mistake with the upcase/downcase "S" in spreadsheets and that could definitely do that.

The pre-created tables thing would make sense. It would have taken me too long to figure that one out. :) For the most part, the extension makes everything feel incredibly easy to build an app like this. Changefeeds are cool, but then piping them into ActionCable easily is awesomely simple. Any typical bottlenecks to watch out for there?

Thanks for the description on the lock query! That makes a lot of sense. I figured it was doing something like that, but too long to figure out in a screencast. I think the opaque query is fine in this case for the most part. I'd rather have that one piece I didn't understand to start with, than extra models, etc that make it harder to wrap your head around.

Awesome job on everything and thanks for sharing this tutorial! :D

Posted in Using Webhooks with Stripe Discussion

It typically depends on what you're doing with the webhooks and what the potential errors are. Maybe a user deleted their account and so you no longer have a matching record for the stripe customer ID, in that case you might let the webhook silently fail. In other cases, you probably want to send yourself an alert email if something goes wrong that's out of the ordinary so you can fix it. I usually leave that for exception_notification or a tool like Airbrake/AppSignal/Sentry to log and handle sending the notification for me.

In general you never want webhooks to fail, so either send yourself an alert so you can fix that case when something went wrong or build in the logic to allow certain cases to skip gracefully and you should be fine.

Posted in Using Vagrant for Rails Development Discussion

Welp, yeah looks like they stopped compiling for 14.04 because it's fairly old now. Looks like they got up to 2.2.1 https://rvm.io/binaries/ubu...

Ubuntu 16.04 LTS does have 2.3.1 https://rvm.io/binaries/ubu...

I would probably recommend changing your Vagrantfile to use "ubuntu/xenial64" instead of 14.04 trusty which should work. I'm going to update the tutorial to use the newer Ubuntu LTS as well because 14.04 is too old.

Try the newer Ubuntu and see if that works?

Posted in Comments With Polymorphic Associations Discussion

I'm more than a little behind, but I added this to my short list!

Posted in Using Vagrant for Rails Development Discussion

What's the error you're getting?

Posted in Multitenancy with the Apartment gem Discussion

Nothing different. An API just doesn't have HTML, JS, or CSS to serve up, but everything else is the same. Any multi-tenancy is on the database level, not the UI level.

Posted in macOS sierra working w/ Ruby / Rails / RBENV?

I believe as long as most of the Homebrew issues for Sierra are sorted and you've got Xcode 8's command line tools installed it should be good. I haven't upgraded yet either, but plan to do that on my laptop once the official release is out.

Pretty sure some other people have tried it here so hopefully they'll weigh in!

Posted in Using Vagrant for Rails Development Discussion

Since we're using rbenv, it should compile Ruby instead of downloading it as a binary. You should be able to change the version numbers, although I haven't tried it with 2.3.1 yet.

Posted in How to setup SSL with a rails app

Hey Francisco,

Heroku has a free beta SSL offering that you can use (rather than the normal $20/mo to use SSL): https://devcenter.heroku.com/articles/ssl-beta

I believe you just need to use the command line to upload your certs and you should be good to go!

Absolutely! I like trying to show how to use a gem as well as showing how you could build your own version from scratch. It makes using any library a lot less daunting when you know you could go in and fix it yourself if you wanted. :)

Got any suggestions you'd like to see?

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

Thanks Mike. Doing my best to keep it updated! :D

Posted in How do i save a field in a separate table?

Hey Alan,

That's a pretty good way of doing it. The logic is that if a user isn't connected to a brand, then don't allow them to edit. The current_user.brands.find actually uses the join table because you're using the association. The only thing you'd need to access current_user.user_brands directly for would be if you were to add and check for roles on that table. Without roles, you can assume that if the role exists, then the user has access to that brand.

Posted in File Uploading with Carrierwave Discussion

Easier said than done, but I have been coding for over 10 years (I started in 7th grade). My routine is usually trying something new at least a few times a week, hopefully daily. I also often try new technologies and compare them to what I know and try to recreate something I know with that. Like React Native vs iOS native swift code for example. Or Python vs Ruby or Django vs Rails. The comparisons help because they give you insight into why the language or framework creators chose to do things the way they did. I'll often read the source code for other apps, but usually it comes down to applying it on a real project. That's why I've got 188 open source repositories on my github. :) https://github.com/excid3?t...

I should do an actual episode on this topic or something. Any specific questions you think would be helpful to answer about my learning method?

Posted in File Uploading with Carrierwave Discussion

So I unfortunately didn't do a great job of including the source code or the steps before the examples here. I've been doing a much better job of that lately. Basically this app just had a model called Book which was a scaffold that has a title column and description column. I also added Bootstrap to make it look pretty, but that's not necessary. That should be all you need. I am revamping the site to organize everything in series so you can watch all the related episodes together, but some of these early episodes only focused on a specific piece and didn't include all the setup instructions unfortunately.

Posted in Realtime Notifications with ActionCable Discussion

You need to have Redis installed and running. If you're on a Mac, "brew install redis" assuming you have Homebrew.

The attr_reader makes it so you don't have to reference the instance variable. "to: customer" points to the attr_reader, allowing you to go swap that out at some point with some other type of reference in the future if you wanted, rather than an instance variable which is useful for future potential refactoring since a attr_reader or function called "customer" would look exactly the same.

Glad I can help, even if it's slow goin' for a bit. Do this a few times and you'll get really comfortable debugging these more complicated processes and be doing them often in no time! :)

And believe me...I've probably wasted months or more of my life to debugging all the various things over the years...

I guess one thing also to note is that since the record hasn't been saved, it won't be able to set the Booking ID in the Stripe description until after the record saves. Maybe initiate an update to store the booking ID reference on there after the save is a better plan.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.