Tag: rails
All the articles with the tag "rails".
-
Retrieving a Random Row in ActiveRecord
Updated:Learn different ways to fetch a random row in ActiveRecord, their trade-offs in PostgreSQL and MySQL, and which method to prefer for performance.
-
Loading CSV Data in Rails: Then vs Now
Updated:A look back at how Rails 2.x apps loaded CSV data into models, and how modern Rails apps can do it more efficiently today.
-
Formatting ActiveSupport::Duration Objects in Rails
Updated:Learn how to format ActiveSupport::Duration objects into concise, human-readable strings with locale support using the duration_in_words gem.
-
Working with HTTP Headers in Rails
Updated:Learn how to safely extract external HTTP headers in Rails while filtering out internal Rack and Rails environment variables.
-
Connecting to Multiple Databases in a Rails App
Updated:Learn how to connect a Rails app to multiple databases using establish_connection, with context on modern Rails features for handling multi-DB setups.
-
Dynamic Full Page Background Images in Rails
Updated:Learn how to set and randomize full-page background images in a Rails app using CSS3 and simple view helpers.
-
Highlighting Current Link in Rails Navigation
Updated:A look back at techniques for highlighting the active link in Rails navigation, with modern alternatives using current_page? and Stimulus.
-
Adding a Close Button to Flash Messages in Rails
Updated:Learn how to add a simple close button to dismiss Rails flash messages and a modern Rails 7+ Stimulus approach.