Chris Oliver

Joined

290,710 Experience
86 Lessons Completed
298 Questions Solved

Activity

You can just skip to the install NGINX + Passenger step if you don't want to install Rails for whatever reason.

Posted in What makes you like Ruby/Rails?

I personally love Ruby because the language is designed for humans first and foremost. You don't have to jump through hoops to make the computer understand it, so you can spend your time thinking about how to communicate ideas in your code. That saves a ton of time in development, and humans are typically the most slow and expensive part of software development.

Rails takes advantage of that and assumes you know the basics of web development and does as much as it can for you. You don't have to worry about the different between GET and POST params, they're just available to you in one spot. There are tons and tons of situations where Rails has already got tools for something I wanted before I knew I wanted it. That's amazing.

The downside is it isn't cool anymore, but if you're doing things just because it's cool, you'll probably be wasting lots of your time. 😜

Posted in How to import javascript from Gems with webpacker

Yep, you can do that. Or if they have a node package, you can use that instead.

Posted in How to import javascript from Gems with webpacker

Just import it in app/javascripts/packs/application.js

import "../myfile"

And put your code in app/javascripts/myfile.js

Also check out https://gorails.com/episodes/webpacker-javascript-in-rails-6

ActiveStorage URLs always go through your Rails app. That's how they generate the resize 200x200 on the fly without precomputing it. That's the primary downside to using ActiveStorage right now.

In a future version of Rails, they will have an option to use direct urls to AWS, but you can't do that right now.

If you want this feature today, you'd be better off using Shrine for file uploads.

Lockbox or attr_encrypted are great for that. You just define an encrypted column instead of your normal one and add a secret key.

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. https://github.com/citusdata/activerecord-multi-tenant

Posted in Scheduling Posts Discussion

CoffeeScript works just fine in Rails 6. https://github.com/rails/webpacker#coffeescript

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: 'new_user@example.com' }, 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. http://excid3.com/blog/sharing-a-devise-user-session-across-subdomains-with-rails-3

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: https://github.com/teamcapybara/capybara#the-dsl