Chris Oliver

Joined

292,760 Experience
93 Lessons Completed
296 Questions Solved

Activity

Posted in How do I add HTTParty to ActiveJob ?

Hey Arnas!

Anytime you see a ROLLBACK in your logs, that means your validations failed.

In development, you print out what errors there are if it fails for debugging pretty easily.

If this is happening in production, you could change to find_or_create_by! so it throws an exception instead instead of silently failing. Then at least you can debug it through your error tracking.

Posted in Setup Windows 10 Discussion

Hey Arnas,

Your Postgres server isn't running. I think most people have the best results installing Postgres on Windows and running it there, then having Rails from WSL connect to that.

I haven't actually used Gitlab's CI, but it's close.

So you don't need a master.key file as long as you have the RAILS_MASTER_KEY environment variable. Rails will check for the env var first and use that if it exists, otherwise it falls back to the file.

You should be able to set the env var using Gitlab and then you'd just need to make sure the env var from Gitlab is accessible in your docker image.

No need to write anything to master.key this way.

Hey soykje!

Rails will actually look for the RAILS_MASTER_KEY env variable, so if you just set that you should be fine. Saves you from the trouble of trying to write that out to a file and you can just set the env var like any other environment variable through docker.

Posted in How do I add Zurb foundation-sites using webpacker?

Hey Jason!

For the most part, you'll just follow their instructions which is usually yarn add package and an import or require of the package in your application.js.

https://foundation.zurb.com/sites/docs/installation.html

There's nothing special to using things now because we're just using Webpack for everything which most all Javascript modules have instructions for on how to use. You can just look for Webpack instructions and follow those almost every time. 👍

Posted in How do I add multiple subscriptions to one user ?

Yeah, you can't subscribe to the same thing twice. You can use quantities if you need something like that.

Posted in How do I add multiple subscriptions to one user ?

Hey Arnas,

Try changing it so you have a Subscription belongs_to :user and a User has_many :subscriptions. Then use the association to handle the subscriptions in your app.

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.