Questions
Ruby questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Determine an Object’s Type in Ruby
Learn how to check an object’s type in Ruby using class, is_a?, and kind_of?, with examples and common mistakes for beginners.
How to Disable RI and RDoc by Default for gem install in Ruby
Learn how to make gem install skip RI and RDoc by default using RubyGems configuration, with examples and common mistakes.
How to Drop Columns in a Rails Migration
Learn the Rails migration syntax for dropping database columns safely, with examples, reversibility, and common mistakes.
How to Duplicate an ActiveRecord Record in Ruby on Rails
Learn the simplest way to duplicate an ActiveRecord record in Rails, change selected fields, and save the new copy safely.
How to Execute a Command Line Binary in Node.js
Learn how to run command line binaries in Node.js using child_process, with examples, safety tips, and real CLI use cases.
How to Find Minimum and Maximum Values in Ruby
Learn how to find min and max values in Ruby using built-in methods, arrays, comparisons, and practical examples for beginners.
How to Find Where Ruby Gems Are Installed
Learn how to find installed gem locations in Ruby, check gem paths, and understand where gems will be installed before installation.
How to Find Where a Method Is Defined at Runtime in Ruby
Learn how to locate a method's source file and line number at runtime in Ruby using Method#source_location and related tools.
How to Fix PG::ConnectionBad: Connection Refused in Rails with PostgreSQL
Learn why Rails shows PG::ConnectionBad connection refused and how to troubleshoot PostgreSQL host, port, and database setup.
How to Fix Ruby Gem Native Extension Errors: Can't Find Header Files
Learn why `gem install mysql` fails with missing Ruby header files and how to fix native extension build errors in Ruby.
How to Fix RubyGems Permission Errors When Installing Gems in Ruby
Learn why RubyGems permission errors happen and how to safely install gems or update RubyGems without write access issues.
How to Fix mysql2 Native Extension Build Errors in Rails
Learn why the mysql2 gem fails to build native extensions in Rails and how to fix missing MySQL client libraries and build tools.
How to Generate a Random Number in Ruby
Learn how to generate random numbers in Ruby, including ranges, inclusive and exclusive bounds, and beginner-friendly examples.
How to Generate a Random String in Ruby
Learn how to generate random strings in Ruby using arrays, ranges, and SecureRandom with clear examples and common pitfalls.
How to Get a Ruby Class Name as a String
Learn how to get a class name from a Ruby or ActiveRecord object using class, name, to_s, and related patterns with clear examples.
How to Get the Current Absolute URL in Ruby on Rails
Learn how to get the full current URL in a Ruby on Rails view, including protocol, host, path, and query string.
How to Implement Enums in Ruby
Learn practical ways to implement enums in Ruby, including symbols, constants, classes, and gems, with examples and common pitfalls.
How to Install a Local Gem in Ruby
Learn how to install a local .gem file in Ruby using gem install, with examples, common mistakes, and practical usage tips.
How to Install a Specific Version of a Ruby Gem
Learn how to install a specific gem version in Ruby using the gem command, with syntax, examples, common mistakes, and real-world usage.
How to Install or Downgrade to an Older CocoaPods Version in Ruby
Learn how to install or downgrade to an older CocoaPods version using Ruby gems, verify the version, and switch versions safely.