Chris Oliver


240,460 Experience
17 Lessons Completed
263 Questions Solved


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!

Posted in Admin Interfaces with Administrate Discussion

I don't think there are any changes between the gem in development and production. You should be safe there.

Posted in Group records by month to display in a chart

I would do something like this (using the group_by_month method from groupdate so it's a bit cleaner).

@tasks    = Task.all.group_by_month(:date, format: "%b %Y").count
@finished = Task.finish.group_by_month(:date, format: "%b %Y").count
@unfinish = Task.unfinish.group_by_month(:date, format: "%b %Y").count

Posted in Group records by month to display in a chart

Ah yeah, your group_by is going to give you a hash. You probably want to do group_bys on those after filtering the queries to make it cleaner.

Posted in Group records by month to display in a chart

Yup! I would recommend doing scopes for this for sure.

Posted in Group records by month to display in a chart

You're welcome man! :)

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.