Activity
Trying printing out the errors
on the object after the valid?
to see what validations are failing. That might help you figure out what's up with that stuff and get you onwards towards the bigger fish. :)
Great! Well I will possibly do both, but that's good to know. I think that's the more important thing, so long as the libraries support what you want!
Refile actually provides a Sinatra app that will let you do this. https://github.com/refile/refile#processing
Using something Shrine, I imagine you can build a plugin to do that similarly.
Be awere that you're definitely going to want to cache this to a CDN because you do not want to have to process an image every single request. That's way too much unnecessary work, so you want to do it the first time and then have it cached in the CDN.
Another option would be to generate say 5 different sizes and let the user specify the dimensions, but use CSS to resize the image in the browser and grab the smallest size that fits those dimensions.
Dropzone will let you do that too. They're pretty equivalent in functionality. The trick is how you handle the uploads. For example, you can make Dropzone work (and look) exactly like jQuery file upload: http://www.dropzonejs.com/b...
The multiple uploads is pretty easy, you send each over to the server, and it'll attach them to the Blog record by creating an individual "Media" record for each of your pictures, videos, etc. You have a one to many relationship server side to handle that stuff.
jQuery file upload is one of the most confusing libraries to work with, so it was on my list to figure out for a while back when I first used it. Dropzone is actually a lot easier so I might use that one instead unless you're tied to jQuery file upload. The nice part about it is that the API is easier, and it doesn't care if you have jQuery or not so you can use it independently.
Yes! They're on my list! Also going to do video uploads with transcoding and taking thumbnails of them.
If it's not getting called at all, check that your route is getting called and the action as well. Your Javascript looks like it will submit the form which should go to the create action of the events booking controller.
The thing is that if it jumps straight to your else statement in the action, then it definitely ran the reserve method. Are you sure that your record is valid? The first line of the reserve
method doesn't attempt to process the booking unless it is valid which means it terminates and returns instantly if the booking doesn't have a valid set of attributes. That's probably your issue (gotta even check those little tiny things) if it's terminating before it gets to your other code.
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.
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?
I'm more than a little behind, but I added this to my short list!
What's the error you're getting?
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.
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!
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?
Thanks Mike. Doing my best to keep it updated! :D