Questions

Ruby questions

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

Add a Default Value to an Existing Column in a Rails Migration

Learn how to add or change a default value on an existing database column using Rails Active Record migrations safely.

rubyruby-on-railsmigration

Calling a Class Method from an Instance in Ruby

Learn how to call a class method from an instance in Ruby using self.class, with examples, pitfalls, and practical usage patterns.

rubyclass-method

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

Check Whether a File Exists in Ruby with File.exist?

Learn how to check whether a file exists in Ruby using File.exist? and File.file?, including paths, directories, permissions, and examples.

rubyfile

Check Whether a Value Is an Array in Ruby and Count Items

Learn how to test whether a value is an Array in Ruby and count its elements with is_a?, length, size, and count.

rubysyntax

Check for Non-Nil and Non-Zero Values in Ruby

Learn idiomatic Ruby ways to test numeric values for nil and zero, including truthiness, zero?, nonzero?, and safe navigation.

ruby

Common Ways to Read Files in Ruby: Methods, Trade-Offs, and Examples

Learn common Ruby file-reading methods, including File.read, File.foreach, File.open, and readlines, with memory and error-handling trade-offs.

rubyfile-io

Compare Ruby Arrays in Any Order with RSpec match_array

Learn how RSpec match_array and contain_exactly compare Ruby arrays regardless of order while preserving duplicate element counts.

rubytestingrspec

Convert CamelCase to snake_case in Ruby with underscore

Learn how to convert CamelCase strings to snake_case in Ruby using ActiveSupport's underscore method and a plain Ruby alternative.

rubyruby-on-railsstringformatting

Convert Ruby Hash String Keys to Symbols

Learn how to convert Ruby hash keys from strings to symbols, including nested YAML data, transform_keys, Rails helpers, and safe parsing.

rubyhashmap

Convert a Unix Timestamp to Ruby DateTime

Learn how to convert Unix timestamps to Ruby DateTime and Time objects, with examples, differences, pitfalls, and practical Ruby usage.

rubydatetimetimestamp

Difference Between `and` and `&&` in Ruby

Learn the difference between `and` and `&&` in Ruby, including precedence, assignment behavior, and when to use each safely.

rubyoperators

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

Does Ruby Have Real Multithreading? MRI Threads, GVL, and CPU Cores

Learn how Ruby threads map to OS threads, why MRI's GVL limits CPU parallelism, and when to use Ractors or processes instead.

rubymultithreadingconcurrency

ERB Comments: Hide Template Notes from Generated HTML

Learn how to write ERB comments that are removed during rendering, compare them with HTML comments, and avoid exposing template notes.

rubyruby-on-railscommentserb

ERB Tags in Rails: Difference Between <% %>, <%= %>, <%# %>, and -%>

Learn what ERB tags mean in Rails: <% %>, <%= %>, <%# %>, and -%>. See syntax, examples, output behavior, and common mistakes.

rubyruby-on-railstemplateserb

Filter Hash Keys with Regular Expressions in Ruby

Learn how to filter Ruby hash keys using regular expressions, select matching choice keys, and join selected values with tab delimiters.

ruby

Fix Bundler GemNotFoundException with Ruby and RVM

Learn why Ruby cannot find Bundler, how RVM gemsets and sudo affect installations, and how to restore Jekyll commands safely.

rubyrubygemsbundlejekyll

Fix Compass Native Extension Build Errors on macOS (Ruby)

Learn why Ruby gem native extensions fail on macOS when installing Compass, how to identify an FFI/Clang mismatch, and safe ways to fix it.

rubymacosterminalcompass-sass

Fix OpenSSL Certificate Verify Failed in Ruby on Rails

Learn why Ruby on Rails raises OpenSSL certificate verify failed errors and how to diagnose CA bundles, certificate chains, and TLS safely.

rubyruby-on-railssslauthlogic

Page 1 of 9 - 162 questions

PreviousNext