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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Difference Between `and` and `&&` in Ruby
Learn the difference between `and` and `&&` in Ruby, including precedence, assignment behavior, and when to use each safely.
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.
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.
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.
ERB Tags in Rails: Difference Between <% %>, <%= %>, <%# %>, and -%>
Learn what ERB tags mean in Rails: <% %>, <%= %>, <%# %>, and -%>. See syntax, examples, output behavior, and common mistakes.
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.
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.
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.
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.
Page 1 of 9 - 162 questions