Questions
Ruby questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Undo a Rails Generator: Reversing `rails generate` in Ruby on Rails
Learn how to reverse `rails generate` in Rails, remove created files, and roll back route and config changes safely.
How to Undo a Scaffold in Rails
Learn how to undo a scaffold in Rails using generators, migrations, and cleanup steps with practical examples for beginners.
How to Uninstall RVM on Ubuntu: Understanding Safe Tool Removal
Learn how to uninstall RVM on Ubuntu safely, remove shell changes, and understand what a version manager modifies on your system.
How to Update Ruby on macOS Yosemite with Homebrew
Learn how to update Ruby on macOS Yosemite using Homebrew, set the correct PATH, and verify the newer Ruby version works.
How to Use a Local Gem in a Gemfile with Bundler (Ruby)
Learn how to reference a local gem in a Ruby Gemfile using Bundler, with syntax, examples, common mistakes, and practical usage.
How to Use the Conditional Operator in Ruby
Learn how Ruby's conditional operator `? :` works, when to use it, and how to write clean ternary expressions with practical examples.
How to Write Multi-Line Comments in Ruby
Learn how multi-line comments work in Ruby, including =begin/=end, line comments, common mistakes, and practical Ruby examples.
How to Write a Switch Statement in Ruby
Learn how switch-style logic works in Ruby using `case`, `when`, and `else`, with examples, common mistakes, and practical usage tips.
How to Write to a File in Ruby
Learn how to write text files in Ruby, save database results, and use Ruby file handling methods with simple examples.
Inspect and Pretty-Print Ruby Objects and Arrays in the Console
Learn how to inspect Ruby objects and arrays with inspect, p, pp, and instance variables for practical debugging in scripts and applications.
Install the PostgreSQL pg Gem on Ubuntu for Ruby
Learn how to fix pg gem native extension errors on Ubuntu by installing PostgreSQL libpq development files and configuring pg_config.
Iterate Through Files in a Directory in Ruby
Learn how to loop through directory entries in Ruby with Dir.each_child, Dir.foreach, absolute paths, and safe file filtering.
Parse JSON and Save Nested Values in Ruby on Rails
Learn how to parse JSON in Ruby on Rails, access nested API response values, and safely save a shortened URL with Active Record.
Pass Command-Line Arguments to a Ruby Script
Learn how to pass account settings to Ruby scripts with ARGV, OptionParser, and environment variables for safe, repeatable automation.
Pretty Formatting JSON Output in Ruby on Rails
Learn how to pretty format JSON in Ruby on Rails using built-in Ruby tools, with examples, pitfalls, and practical debugging use cases.
Rack Middleware in Ruby: A Beginner-Friendly Explanation
Learn what Rack middleware is in Ruby, how it processes HTTP requests and responses, and how to build and use a simple middleware class.
Rails Collection Routes vs Member Routes Explained
Learn the difference between Rails collection and member routes, how URL parameters work, and when to use each with practical examples.
Rails Database Tasks Explained: db:migrate vs db:reset vs db:schema:load
Learn the difference between Rails db:migrate, db:reset, and db:schema:load with examples, use cases, mistakes, and a practical mini project.
Rails I18n Locale Validation Warning: enforce_available_locales Explained
Learn what Rails I18n.enforce_available_locales does, why the deprecation warning appears, and whether setting it to false is safe.
Rails Response Content-Length Warning: Meaning and Fixes
Learn why Rails 3.1 logs “Could not determine content-length,” how HTTP response bodies are framed, and how to fix custom Rack responses safely.