
Routing & Controllers
RESTful routes, resources, nested routes, basic actions, params, strong parameters
1In a Rails application, where is the main route configuration file located?
In a Rails application, where is the main route configuration file located?
Resposta
The config/routes.rb file is the central point for defining all routes in a Rails application. This file maps incoming URLs to their corresponding controllers and actions. Rails reads this file at application startup to build the routing table that determines how each HTTP request will be handled.
2How many routes are generated by the declaration resources :articles in the routes.rb file?
How many routes are generated by the declaration resources :articles in the routes.rb file?
Resposta
The resources declaration automatically generates 7 standard RESTful routes: index (GET /articles), show (GET /articles/:id), new (GET /articles/new), create (POST /articles), edit (GET /articles/:id/edit), update (PATCH/PUT /articles/:id), and destroy (DELETE /articles/:id). This Rails convention significantly simplifies routing configuration for standard CRUD operations.
3Which HTTP method is used for the create action of a RESTful resource in Rails?
Which HTTP method is used for the create action of a RESTful resource in Rails?
Resposta
The create action uses the HTTP POST method following REST conventions. POST is used to create new resources because this method is not idempotent (calling it multiple times creates multiple resources). The form generated by the new action sends its data via POST to the controller's create action.
What is the difference between resource (singular) and resources (plural) in Rails routing?
How to limit the routes generated by resources to only include index and show?
+19 perguntas de entrevista
Outros temas de entrevista Ruby on Rails
Ruby Basics
Ruby Object-Oriented Programming
Rails Fundamentals
ActiveRecord Basics
Views & ERB Templates
ActiveRecord Associations
Advanced ActiveRecord Queries
Rails Forms
Authentication & Authorization
Modern Asset Pipeline & Frontend
Rails API Mode
Testing with RSpec
ActiveJob & Background Jobs
ActionCable & WebSockets
ActionMailer
ActiveStorage
Caching Strategies
Advanced Migrations
Rails Engines & Modular Apps
Performance Optimization
Rails Design Patterns
Ruby Metaprogramming
Rails Security
GraphQL with Rails
Deployment & Production
Monitoring & Logging
Rails Upgrade Strategies
Domine Ruby on Rails para sua proxima entrevista
Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.
Comece gratis