Chris Oliver

Joined

234,960 Experience
17 Lessons Completed
256 Questions Solved

Activity

Posted in Subscriptions with Stripe Discussion

Pretty much! You would create the plan in stripe (it requires it to be attached to a product these days). Once you had the Stripe plan ID, you can use that to create a subscription:

customer.subscriptions.create(items: [{ plan: 'plan-id' }])

or

Stripe::Subscription.create({
  customer: 'customer-id',
  items: [{ plan: 'plan-id' }],
})

Posted in Have Stripe public key show up

Ah you already fixed it! :D

Posted in Have Stripe public key show up

Double check you have the rbenv-vars plugin installed. You should verify that is loading ENV vars from it. Then make sure you have RAILS_MASTER_KEY=x set in it. Probably something simple missing there.

Ah yeah, you would need that if you're on Heroku. I use NGINX on my own server which automatically serves static files, so that would make sense. Hah!

Hey Jason, the Javascript console is just the one in your browser.

Anyways, what if you try putting your javascript file in the asset pipeline and requiring it in your application.js so you go through the standard Rails javascript includes?

Hey Jason,

That looks correct. Any static files you don't want going through the asset pipeline or webpacker would go in public somewhere and you would just link to it accordingly (minus the public of course).

What's your production javascript console say? It can't find /javascripts/lib/add_all_plots.js?

No secret handshakes, but I kinda wish there was now...

var tailwindcss = require('tailwindcss');

module.exports = {
  plugins: [
    // ...
    tailwindcss('./path/to/your/tailwind.js'),
    require('autoprefixer'),
    // ...
  ]
}

Webpacker 4.0 now uses the .js configs so they're more flexible than the yml versions.

Posted in Screencast requests: Global ID and @mentions

I gotcha! Sorry, I wasn't sure what you were getting at.

In that case, I should note that ActionText is pretty simple behind the scenes. If you were to implement your own thing, you'd end up building like 90% of ActionText. I don't think you'd get any benefit from doign that.

Posted in Can someone please do me a big favor?

I understand it can be hard to subscribe sometimes. If you submit a transcript for an episode, I'm happy to give you a free month of GoRails.

For example, these are a couple episodes that could use transcripts:
https://gorails.com/episodes/how-to-use-action-text?autoplay=1
https://gorails.com/episodes/at-mentions-with-actiontext?autoplay=1

Posted in Liking Posts Discussion

"Bookmark" might be an easier name to work with on the backend and then just use a different term for the UI.

Posted in Liking Posts Discussion

Yeah, if you ever overwrote the save method like with an association, then that would cause problems. Almost certainly was your issue.

Hey Muhammad, I think you'll need to take a look at /var/log/nging/error.log and see why it's failing. You can also run nginx -t to determine if you have a valid config. It might just be that you have a typo in your config somewhere.

Posted in How to monitor account progress?

Sorry it took me a bit longer than I hoped. Just published an episode on this today! https://gorails.com/episodes/user-onboarding-progress-bar?autoplay=1

Posted in in app notifications using stimulus and ujs

You have to .bind(this) if you want to retain the context/scope when passing in a function for a callback, otherwise it will use the callback's scope for this.

        success: this.handleSuccess.bind(this)

Javascript is real weird.

Umar,

I would say no, you do not not microservices or separate frontend/backends.

You're free to use whatever frontend you want, but in a monolithic app, think of it more like the frontend dev works on the views, css and javascript while you handle more of the controllers and models. You can get everything ready for the frontend dev, setting up forms and instance variables so they can go ahead and work with the data you provided them.

That collaboration can work if you're using a frontend framework too though. You would provide urls for them to retrieve data, but there's no need for that unless you want to.

Posted in User Referral Program From Scratch Discussion

What's the error?

Hey Umar!

I've worked a lot in the past with frontend devs as the only backend developer. For the most part, we split responsibilities such that the frontend dev would tell me what information they needed, and we would figure out the params and response formats for API requests. We'd kind of split it there so the frontend dev could handle all his needs and as the backend dev I'd just be worrying about building the API endpoints for what he needed. Inevitably you start to learn how they're building out the frontend and the frontend dev is learning how the backend works over time.

That worked out quite well for us, but there are also lots of other routes you could go.

Yeah, you were manually replacing part of the functionality that's built-in to Rails there.

I don't see anything in this code for deleting authors, just adding new ones so that's part of the problem.

Posted in Deploy Ubuntu 18.04 Bionic Beaver Discussion

It definitely works with Lightsail, but we can't help you if you don't explain what you're having trouble with.

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.