Questions

Ruby questions

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

How to Write to a File in Ruby

Learn how to write text files in Ruby, save database results, and use Ruby file handling methods with simple examples.

rubyfile-io

Pretty Formatting JSON Output in Ruby on Rails

Learn how to pretty format JSON in Ruby on Rails using built-in Ruby tools, with examples, pitfalls, and practical debugging use cases.

rubyruby-on-railsjsonpretty-print

Rails Database Tasks Explained: db:migrate vs db:reset vs db:schema:load

Learn the difference between Rails db:migrate, db:reset, and db:schema:load with examples, use cases, mistakes, and a practical mini project.

rubyruby-on-railsdatabaserake

Remove a Key from a Hash in Ruby: delete vs reject and Returning the Remaining Hash

Learn how to remove keys from a Ruby Hash using delete, reject, except, and non-mutating patterns with clear examples and common pitfalls.

rubyruby-on-railsruby-on-rails-3hashmap

Ruby Bang Methods Explained: What ! Means in Ruby Method Names

Learn what exclamation marks mean in Ruby method names, when bang methods are used, and how they differ from non-bang methods.

rubymethodsnaming-conventionsimmutability

Ruby Loop Control: The Equivalent of continue in Ruby

Learn the Ruby equivalent of continue, how `next` works in loops, and when to use it with clear examples and common mistakes.

rubykeywordcontinue

Understanding `class << self` in Ruby

Learn what `class << self` means in Ruby, how it works, when to use it, and how it compares to other ways of defining class methods.

rubymetaclasseigenclasssingleton

Understanding nil?, empty?, and blank? in Ruby and Rails

Learn the difference between nil?, empty?, and blank? in Ruby on Rails with examples, comparisons, common mistakes, and practical usage.

rubyruby-on-rails

Understanding the Rails Authenticity Token in Ruby on Rails

Learn what the Rails authenticity token is, why it exists, and how it protects forms from CSRF attacks in Ruby on Rails apps.

rubyruby-on-railsauthenticity-token

What %w Means in Ruby: Array of Strings Syntax Explained

Learn what %w means in Ruby, how it creates arrays of strings, when to use it, and how it compares to normal array syntax.

rubyarraysstringnotation

What attr_accessor Means in Ruby: Getters and Setters Explained

Learn what attr_accessor does in Ruby, how it creates getters and setters, and when to use attr_reader or attr_writer instead.

ruby

Why `rescue Exception` Is Bad Style in Ruby

Learn why rescuing Exception in Ruby is dangerous, what to rescue instead, and how to handle errors safely in real code.

rubyexception

Page 2 of 2 - 32 questions