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.

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 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.

rubyrubygems

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.

rubyruby-on-railsruntimemethods

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.

rubyruby-on-railsdatabasepostgresql

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.

rubymysqlrubygems

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

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.

rubyruby-on-railsrails-activerecord

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.

rubyruby-on-railsurl

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.

rubyenums

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.

rubyrubygems

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.

rubyrubygems

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.

rubyiosrubygemscocoapods

Page 2 of 6 - 112 questions