P
prepair.app
Start interview →
EnglishУкраїнськаРусский
💎

Junior Ruby on RailsRuby on Rails interview questions

Junior · no experience / under 1 year

Ruby interviews go two layers deep: the language itself — blocks, modules, the method lookup chain — and then Rails, where most questions are really about ActiveRecord and the database underneath it. Below are the questions asked most often, each with a model answer. Junior: core theory, definitions, and simple practical cases.

Topics to prepare

Ruby core and blocks
OOP, modules and mixins
ActiveRecord and associations
Rails MVC, routing, controllers
N+1 queries and performance
RSpec, FactoryBot, Rubocop

7 Junior-level questions with answers

1

What is truthy and falsy in Ruby?

Answer

Only nil and false are falsy — 0, '' and [] are all truthy. This trips up anyone arriving from JavaScript or Python. It means if list is true even for an empty list, so when you mean empty you have to say list.empty?.

2

What is the difference between `nil?`, `empty?` and `blank?`

Answer

nil? asks whether the object is nil. empty? asks whether a string, array or hash has no elements — and it explodes on nil, because nil has no empty?. blank? comes from Rails and covers both plus whitespace-only strings, which is why it is the one you usually want on form input.

3

What is the difference between a symbol and a string?

Answer

A symbol is immutable and reused — :name is the same object everywhere. A string literal creates a new object each time. Use symbols for names of things (hash keys, statuses) and strings for text you show or change.

4

What does `attr_accessor` do?

Answer

It defines a getter and a setter for an instance variable, so you do not write them by hand. attr_reader gives only the getter, attr_writer only the setter. Reaching for attr_accessor by default is a habit worth breaking — most attributes should not be writable from outside.

5

What is a block and how do you pass one?

Answer

A chunk of code handed to a method with do...end or { }. Inside the method yield runs it, and block_given? tells you whether one arrived. each and map are ordinary methods — there is no special syntax making them work, just blocks.

6

What is MVC in Rails, and what belongs where?

Answer

The model holds data and the rules about it, the controller receives the request and decides what to do, the view renders the response. The practical rule: business logic belongs in the model or a service object, not the controller, and a view that queries the database is a view doing the controller's job.

7

What is a migration and what is `schema.rb`?

Answer

A migration is a versioned change to the database — a Ruby file you run forward. schema.rb is the generated snapshot of the current structure, which is what a new machine loads instead of replaying every migration since the beginning. You edit migrations; you do not hand-edit the schema file.

🦎

Reading answers is not enough

In a real interview you speak under pressure. Cam asks these same questions, scores every answer, and shows exactly what to fix.

Practice a Junior Ruby on Rails interview →
Free · 3 interviews per month

Other levels — Ruby on Rails

Middle Ruby on RailsSenior Ruby on RailsAll Ruby on Rails questions

Other specializations

🔍Junior Manual QA🤖Junior QA AutomationJunior Java Backend🐍Junior Python Backend🐘Junior PHP Backend🦫Junior Go Backend🟢Junior Node.js Backend🔷Junior C++🟨Junior JavaScript⚛️Junior React Frontend