Chris Oliver


256,320 Experience
22 Lessons Completed
282 Questions Solved


Posted in Multitenancy with the Apartment gem Discussion

Hahaha, I noticed that the other day. It won't capitalize, I couldn't paste. SimpleMDE is not very good on mobile it seems. Might have to replace it with Trix, but we lose Markdown support. :(

Posted in Skip Stripe checkout for user with certain conditions

Hey Anthony,

After the user signs up through the referral link, you can add the free post to their account. That might just be a column on the user model to keep track of it, up to you.

Then you can check if the user has a free post and let them post. If they don't, redirect them to the pricing page. You probably have a before_action in your PostsController to redirect if not subscribed, so you can modify that to allow them through if they have a free post. Once they complete the Post, then they you can remove that column on the user so they can't do it twice.

Posted in Welp. They just let me go.!!

Oof, that sounds awful. Any company should expect that you have a month or two of onboarding as you get used to the product, how it works, and how the team makes decisions and implements things.

If a company is still on Ruby 1.9.3 and Rails 3.2 these days, then they've probably got some serious technical debt and don't know how to dig themselves out of it. That's a bad sign.

Sounds like you dodged a bullet!

Posted in Multitenancy with the Apartment gem Discussion

Citus which is a Postgres company designed around supporting multi-tenancy always recommends using row based segregation. They've built this gem which I would highly recommend.

Posted in Scheduling Posts Discussion

CoffeeScript works just fine in Rails 6.

Posted in User Referral Program From Scratch Discussion

You can just call the complete_referral! method anytime the user completes the steps you want. If you want to do that right after registration, go add that after sign up. 👍

Posted in Inviting Users with devise_invitable Discussion

Nothing special for that really. If you have two models, you have current_user and current_admin because Devise separates those out. Devise Invitable has a polymorphic invited_by column, so you can pass in any object for that.

Your invite code would look like this:
User.invite!({ email: '[email protected]' }, current_admin)

Posted in API Authentication with an OAuth Provider Discussion

I just add a constraint around it in my routes.rb.

Posted in Rails Application Templates Discussion

Rails application templates only work for generating new apps, so you can't get any updates on an existing app with them.

You can read through the changes and apply them to your app though. It's a manual process instead but it will get you updated.

Posted in Jumpstart pro configuration question

Jumpstart Pro doesn't currently have any marketplace functionality. You could add it yourself separate from the payments that are built-in to Jumpstart Pro.

You'd use the stripe connect omniauth gem to let the users login with Stripe and then you would need to setup payments through Stripe Connect on your account that run payments on the user's connected Stripe account. It's been a while since I've done any of that.

That's something I'd love to add in the future, but not sure when I'll be able to get to that.

Posted in Sub-site Authentication? (FAQ / KB / Helpdesk etc.)

Really old post of mine that's relevant here. I bet it's the cookie domain you need to update in both apps.

Posted in Sub-site Authentication? (FAQ / KB / Helpdesk etc.)

It's been quite a while since I've deployed it. If it's crashing on User.first then I assume you need to maybe run a rake task to setup a User or create one in the Rails console first? Not real sure.

Posted in How to write System Tests in Rails Discussion

All the methods can be found in their docs:

Posted in Open Closed Principle Discussion

I definitely think you should raise some error, it doesn't have to be NotImplementedError. The main reason you want to do that is because it provides a clear explanation why something didn't work.

You don't want to assume people are going to read the docs and implement every method correctly on the first try. It's very likely that won't always be done perfectly. Raising the error helps guide the developer on how to properly implement their subclass which is very helpful. I don't use and IDE, but if there are benefits there, then that's another reason that makes it more intuitive to use for other developers.

Posted in Admin Interfaces with Administrate Discussion

Yeah, should be. I have been using my own fork of it too.

You'd just use the Heroku action as the last step I believe:

Posted in Tracking Metrics with Ahoy and Blazer Discussion

Yeah, should be able to set it up without Users. That's what guests are anyways, they don't have a User. You can always ask on the GitHub issues for it and get tips from the author. 👍

So what I would probably do here is actually:

resources :milestone do
  member do
      post :activate, to: "milestones/activations#create"
        delete :deactivate, to: "milestones/activations#destroy"

Then you can have a app/controllers/milestones/activations_controller.rb that handles them. That's great for separating out the logic from the main CRUD, and your routes aren't too complicated.

I'll often make a singular resource for things like this too.

resources :milestone do
  scope module: :milestones do
      resource :activate

Works a bit better if you're doing like resource :advanced_search or something.

In your case, DELETE /milestones/1/activate doesn't make sense, and you'd want the destroy route to be DELETE /milestones/1/deactivate so it's more intuitive. And that's why I'd probably write the custom routes instead of resources in this case.

I think it's fine for you to make some non-standard actions here.

Are these actions changing the Milestone record or are they change an Activation / Completion records associated to a Milestone?

Posted in Sub-site Authentication? (FAQ / KB / Helpdesk etc.)

Helpy is great! Deployed it via Hatchbox a little while back and it keeps improving.

I think you can probably use the API to create users after they're created in the main app.

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

© 2021 GoRails, LLC. All rights reserved.