Check versions installed on your machine: rbenv versions Install a specific version to your machine: (replace 3.1.2 with the version you want to install) rbenv install 3.1.2 Install the latest stable version of Ruby: rbenv install -l Set the Ruby version of a specific application by
I restarted my MacBook tonight and when I attempted to start up my Rails development environment I encountered the following error: connection to server at "localhost" (::1), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? The problem is due to PostgreSQL
You can edit your Rails credentials file using the nano editor in Terminal using the following command.
You can use RubyMine to edit your Rails credentials file on Mac with the following command: EDITOR="/Applications/RubyMine.app/Contents/MacOS/rubymine --wait" rails credentials:edit This will open the file for editing in RubyMine and wait until the file is saved before saving and encrypting the encrypted version
Over the weekend I was working on a side project and I found myself needing to improve the speed of certain methods, so looked up some ways to measure time in Ruby for this purpose. Several posts gave the obvious answer - set a start_time variable at start, set
I’ve run into this issue on two different Mac machines now so I figured I would document the solution if it comes up again or if it comes up for someone else. Basically – you can’t get your terminal to use the Ruby version that you want. You run
This is a reusable pagination concern that provides a simple solution for pagination in a Ruby on Rails application. Some of the code comes from Jonathan Allard who originally shared it here. However, I came across issues with the original code when specifying which page should be displayed. Rails would
TL;DR: spin up a new rails app with Tailwind with this command: rails new app --css tailwind I don’t know about you but I feel like my life would be just a tiny bit better if I didn’t ever have to ever work with CSS – which is
In a Rails app, when dealing with controllers that live within the same directory, we can create a base controller that those controllers can inherit from. This approach allows us to keep our code DRY and clean. controllers/ application_controller.rb admin/ base_controller.rb posts_controller.rb comments_controller.
I just deployed a change to Heroku where I added a .jpeg image and it broke the app. Apparently, you cannot use .jpeg extensions on Heroku – at least not using Rail’s <%= image_tag %>. I didn’t attempt to use an HTML tag to see if the issue still occurred.
Finally had some time to dive into Rails Hotwire earlier this week and the process was so smooth. It really does feel like “new magic” and I cannot wait to get started on some new projects with this. However, apparently, Devise does not yet work out of the box with