Activity
I think you can just run "sudo apt-get remove passenger" for that.
Posted in Performing calculations using scopes
Hey John,
You can absolutely make a method that adds the counts like that. You wouldn't be able to turn that method into a scope, because it's not returning a relation, but rather a number.
Also I'd suggest combining your where clauses for cleanliness:
# Convert
where(present: false) && where(reason: "Emergency Leave")
# to
where(present: false, reason: "Emergency Leave")
You might just need to add a float: right
to the label with some CSS which may do the trick.
The other alternative I can think of would be to just mix and match your simple form and normal form html tags. I usually do this when I want most of a form to be simple form styled but one field needs to be custom. It's usually easiest to just write up the form html like I would with a regular form_for and simple_form will let you mix and match like that. That could be another approach that would do the trick.
Subdomains are definitely great if you want them separate. If you're building something public, you could do basically what you posted originally, although it's sometimes nice to also set the schools module as well. That will just help you organize your controllers and views nicely.
resources :schools do
resources :forum_threads, module: :schools do
resources :forum_post, module: :forum_threads
end
end
And this would generate urls like /schools/my-school/forum_threads/i-have-a-question
with /forum_posts
tacked on the end as a route that you'll mostly just interact with through forms.
Apartment is definitely awesome if you want to separate out everything (so it's not as easy to just switch schools in the url). The way this would work is that you can use subdomain helper with Apartment. It would select the right database schema for you and keep everything separated out at the database level. You wouldn't need school_id
on your forum threads or anything with that and your routes would simply be:
resources :forum_threads, module: :schools do
resources :forum_post, module: :forum_threads
end
Posted in Basics commands for using MacVim
Thanks Ryan! I can't remember if I covered it in-depth enough in this episode, but I should do another Vim related screencast going a bit more into it all.
Yeah, with the new token system, this might be a piece of data you can get somewhere. I'd ask on the Refile Github issues and see what you find out. If you find a solution, let me know!
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: 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. :)