Questions

Ruby questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Calling an Overridden Monkey-Patched Method in Ruby

Learn how to call the original method when monkey patching in Ruby, including alias_method patterns, examples, pitfalls, and practical usage.

rubymonkeypatching

Difference Between require and include in Ruby

Learn the difference between require and include in Ruby, when to load a file, and when to mix module methods into a class.

rubyclassmoduleinclude

Fixing Ruby Gem Native Extension Errors: mkmf.rb Can't Find Header Files for Ruby

Learn why Ruby gem installs fail with missing ruby.h, how native extensions work, and how to fix header file errors on Linux servers.

rubyjsonrubygems

How to Add One Array to Another in Ruby Without Creating a Nested Array

Learn how to combine arrays in Ruby without getting nested arrays or nil values. Understand push, concat, +, and flatten clearly.

rubyarraysmultidimensional-array

How to Call Shell Commands from Ruby and Capture Output

Learn how to run shell commands in Ruby, capture output, check exit status, and choose the right method for scripts and apps.

rubyshellinterop

How to Check Whether a String Contains a Substring in Ruby

Learn how to check if a string contains a substring in Ruby using include?, match, and multiline string examples.

rubystring

How to Check if a Hash Key Exists in Ruby

Learn how to check whether a specific key exists in a Ruby hash using key?, has_key?, and include? with clear examples.

rubydata-structuresassociative-array

How to Check if a Value Exists in an Array in Ruby

Learn how to check whether a value exists in a Ruby array using include?, with examples, common mistakes, and practical use cases.

rubyarrays

How to Check if a Variable Is Defined in Ruby

Learn how to check whether a variable is defined in Ruby using `defined?`, with examples for local, instance, class, and global variables.

rubyreflection

How to Convert a String to Lowercase or Uppercase in Ruby

Learn how to convert strings to lowercase or uppercase in Ruby using upcase, downcase, and related methods with simple examples.

rubystringuppercaselowercase

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.

rubytypes

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.

rubyrubygems

How to Drop Columns in a Rails Migration

Learn the Rails migration syntax for dropping database columns safely, with examples, reversibility, and common mistakes.

rubyruby-on-railsdatabaseactiverecord

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.

rubyruby-on-railsrails-activerecord

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.

rubyjavascriptnode.jscommand-line-interface

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.

rubyenumerable

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.

rubymacosrubygems

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.

rubymysqlruby-on-railsrubygems

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.

rubyruby-on-railsruby-on-rails-3ruby-on-rails-4

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.

rubyrandompasswords

Page 1 of 4 - 62 questions

PreviousNext