Activity
Posted in Use .ENV instead of Secrets.yml for keys
Rails 5.2+ switched to using Credentials instead of secrets.yml. I would recommend using that going forward.
That said, if you still want to use .env files, You can use a gem like Figaro to load the .env in development.
Cookies are shared between them all, so yes it would.
I'm not sure about options for Heroku, but when you use a VPS (like DigitalOcean) you get a static IP for your server (as long as you don't destroy the server).
You can also get a Floating IP that allows you to swap out the server behind that IP seamlessly so the IP does not change. That's what I use for my apps that I deploy with Hatchbox.io
Thanks for joining me Kasper!
You could write a filter to try to skip those, but yeah that's generally something you have to always deal with having this feature.
Posted in Esbuild
I noticed the sassc-rails gem will enable itself in production if there is no css_compressor set. You might set css_compressor = nil
and see if that fixes it.
Posted in error in rake db:create command
Like the error says, your postgres server is not running. You need to start your postgres server and then it can connect.
Posted in Finding video
The other episodes in the series are Pro episodes. That's why they're only previews on YouTube.
Hey Tommy!
You would probably need to do this with wildcard URLs and then parse them.
# At the very bottom of your routes file so it doesn't override other GET routes
get "*place" => "places#show"
This should assign params: { place: "walkable-places-in-europe"}
And you could parse that string with Regex or similar to get your filter and location out of it in the controller.
I almost always nest them in folders. It's very helpful when your app grows. Often times you might have 2 or 3 controllers with the same name that do different things and the nesting in folders helps separate them out.
For example,
websites/pages_controller
might be for website editor
subdomains/pages_controller
might be for people viewing the website
admin/pages_controller
might be for the business owner (you) to do customer support
Hey Tom,
You're on the right path. The controller would be "nested" or similar. Basically, you'd lookup the Website before you lookup the Page (so you can make sure you only display the website's pages and no others).
You can do that with nested routes like /websites/1/pages/2
. Here, your controller would look up the website with Website.find(params[:website_id])
from the URL.
Also, you could use domains / subdomains to lookup the website. Then you wouldn't need nested routes and you could have subdomain.example.com/pages/2
. In this case, your controller would do Website.find_by(subdomain: request.subdomain)
Not really. They tried that with webpacker and it didn't work because things change so often and every app needs flexibility to adjust for their use case.
The way JSbundling is setup, you can use any tools you want. The only requirement is they dump to the asset pipeline. That's super flexible and you can make any changes you need. Great balance I'd say.
I had the exact same thoughts!
I don't believe you'll be able to use .js.erb responses in Turbo going forward. They're pretty much replaced by TurboStreams. 👍
No package nodejs available
Sounds like your nodejs repository hasn't been loaded / updated so it can find the nodejs package.
- You should install node LTS instead of 12.x, that way you'll always be on the stable version.
- The error says you're trying to install Yarn without nodejs. You should install nodejs either before or at the same time as you install yarn.
Something like this is more what you want I imagine:
01_install_yarn:
command: "sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo && curl --silent --location https://rpm.nodesource.com/setup_12.x | sudo bash -"
02_install_nodejs:
command: "yum -y install nodejs yarn"
Posted in API CRUD Actions Discussion
Yep, it's released as the vultr gem! 🚀
Skylight (my favorite), AppSignal, New Relic, etc are useful as they'll monitor your app's response times and can help you pinpoint slow stuff like queries or views.
Sounds like a lot of requests all came in at once. That's can happen when you're load testing, have a big spike in traffic (like launching something new) or if you're getting attacked by malicious users.
You can increase Passenger's queue size configuration, but it may just fill up the larger queue if Rails isn't processing requests fast enough. You might want to check and make sure that your response times in Rails are not slowing down with slow views / queries.