Chris Oliver


234,960 Experience
17 Lessons Completed
256 Questions Solved


Posted in Setup Ruby On Rails on Ubuntu 15.10 Wily Werewolf

I would love that! :)

Hmm, well then it isn't as easy of a solution. ;) Which line of the view is it tripping on then? What's your stacktrace look like?

Your first collection_select for @team, is that variable an array? Only arrays (or enumerable objects) have a map method. The map method is called internally inside the collection_select, so if that happens to be just a team record, then that could be the problem.

You'll either want to make that variable an array or adjust that accordingly to how you want it to work I think.

Posted in Using Webhooks with Stripe Discussion

Unfortunately, the current_period_end will be the end of the year, not the end of every month on a yearly plan. You won't get that attribute updated each month to enable your users to have a subscription that acts monthly but is actually yearly.

I think both of those webhooks will fire at the same time for subscriptions. The invoice is generally better because it's tied to the subscription, but the charge attributes might also link to it.

I forgot how expensive Baremetrics was. That's kind of ridiculous. I've been using BeStunning for GoRails and it does a pretty decent job (if you can overlook it's terrible design). :)

And yes, it'll listen to the failed charges via webhooks. You could pretty easily build your own solution and save some money. That's probably my plan for things in the future.

That's a good question. I've never actually checked into that. You should ask on the Github Issues for Devise. They'll definitely know the answer to that.

Posted in Subscriptions with Stripe Discussion

For coupon codes, you could put a form field on the page and then have the JS from the Checkout button submit that over as well in the callback along with the credit card details. It just can't be added to the Stripe Checkout form unfortunately.

Thanks for sharing this Thomas! That sounds like a pretty good solution. Were there any gotchas that you ran into?

Posted in in app notification

I just recorded an episode for this today! Should be uploaded tonight and I'll send an email out about it tomorrow.

It really depends on what your application needs. There are "dunning" emails that need to be sent when a payment fails because the card is expiring or has expired. Although it's easiest to just pay for a service like Baremetrics to do this for you each month (and get their metrics). I've been considering building a service for this that's significantly cheaper (or free) compared to the Dunning options out there. Maybe I'll build it and add some screencasts for it.

Aside from that, you don't really need much else if it's a basic subscription app. If you're building a marketplace or something, you'll end up wanting to integrate a lot more stuff since it's a lot more complicated.

Posted in Nested forms with rows like a table

You could either do this with CSS or you can probably just wrap the form around a table and put the fields inside the cells like this:

Posted in Nested forms with rows like a table

Sounds like a fun little form. :)

So you have a working form but wan to make it look like a table? Is that correct?

Glad you got it working! I wondered if that might be the case. It looked like everything would work from here. :)

Yes that does look correct. Remember that this only fires at real period end, not when they cancel.

Are you sending over some test events for it that aren't finding the user?

Posted in Multiday with calendar gem

Maybe Javascript libraries like but no gems that I'm aware of.

Posted in How do I make comments show the user who created it?

Ah hmm, I can't remember, did that episode include adding a user_id column and belongs_to :user association to the comments? I thought it did but it's been a while. :)

If you don't have that, you'll need to do that to reference the user and that should do the trick.

Posted in Multiday with calendar gem

So right now there's no way to do that with simple_calendar. It's a somewhat complicated thing to do to reproduce Google Calendar style multi-day events.

One option you have is to add some code to the view to look for events that started before the current and end on or after it to find multi-day events. You can create a helper to do that or add some code to your controller.

At some point I'll be patching that in simple_calendar to help make it easier.

Posted in How do I make comments show the user who created it?

You can do exactly what you've got here with the association on the comments. What's not working?

Nothing really. It's pretty straightforward. You just want to use remote: true on the form and add the JS response to the action like you normally would. That's about it!

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.