Date.current vs Date.today in Ruby
Date.current and Date.today look interchangeable but behave differently when your server and app timezones don't match. Here's what each one actually does and when to use which
share my experience and my learning with Ruby on Rails codebase.
View all tagsDate.current and Date.today look interchangeable but behave differently when your server and app timezones don't match. Here's what each one actually does and when to use which
How to set up dotenv-rails, which .env files to create, how file loading priority works, and what belongs in each file.
How to inspect, debug, and understand the SQL ActiveRecord generates using the Rails console.
Use .limit() to restrict query size. When the frontend needs page count or navigation metadata, reach for a pagination gem like Pagy.
How to choose between text[] array and jsonb when storing a list of objects in PostgreSQL with Rails.
Rails.env checks which environment your app is running in. ENV reads OS-level variables. Here's how each works and when to use ENV.fetch over ENV[].
Use &. to avoid NoMethodError when a value in a method chain might be nil. Here's how it works, when to use it, and how it differs from Rails's try.
store_accessor maps top-level keys in a JSONB column to model attributes, giving you validations, dirty tracking, and clean access without extra columns. Here's how it works and when to use it over dedicated columns.
What Rails console is, how to start it, and the commands you'll use most in daily development.
Zeitwerk derives constant names from file names using camelize. When your class uses an acronym like AI, API, or CSV, you need to register it or Rails won't find it.