💎 Ruby on Rails
Beginner
What is Rails console?
Answer
The Rails console (rails console or rails c) provides an interactive Ruby REPL (Read-Eval-Print Loop) with the full Rails application environment loaded. You can query the database (User.all), create records, call model methods, test code snippets, and inspect configuration — all without writing a script file. In production, use rails c --sandbox to prevent any writes from being committed. The console is invaluable for debugging, data inspection, and one-off data fixes.
Previous
What are Rails environments and how do you check the current one?
Next
What is the difference between belongs_to and has_one?