Chris Oliver

Joined

291,590 Experience
86 Lessons Completed
296 Questions Solved

Activity

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: https://www.cs.tut.fi/~jkorpela/forms/tables.html

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 http://fullcalendar.io/ 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! :)

Posted in Group records by month to display in a chart

You can make that a bit easier if you do select too:

@tasks      = Task.group_by { |t| t.start_date.strftime("%B/%Y")} 
@finished   = @task.select{ |task| task.status == 'Complete' }
@unfinished = @task.select{ |task| task.status == 'Cancel' }