Ruby On Rails Top 50 Questions For Freshers
Ruby On Rails Top 50 Questions For Freshers
Ruby on Rails is a web application framework written in Ruby. It follows the MVC
(Model-View-Controller) architecture.
2. What is Ruby?
3. What is MVC?
MVC stands for Model-View-Controller. It separates the application logic (Model), UI (View), and
Gems are libraries or packages in Ruby that extend the functionality of your app.
6. What is ActiveRecord?
It's the ORM layer in Rails that helps in database interaction using Ruby classes.
Migrations are used to modify the database schema over time in a consistent and easy way.
`render` displays a view, `redirect_to` sends a new HTTP request to a different action or controller.
Routes that follow REST principles - using HTTP verbs like GET, POST, PATCH, DELETE.
`resources :model_name`
A hash that stores data from the request (form data, URL params, etc.).
`params.require(...).permit(...)`.
`Model.all`
`Model.find(id)`
`Model.create(attribute: value)`
`model.update(attribute: value)`
`model.destroy`
`bundle install`
40. What is the difference between development, test, and production environments?
These define different settings and databases for each stage of the app lifecycle.
A hash used to send temporary messages (e.g., success, error) between actions and views.
CSRF (Cross-Site Request Forgery) is prevented in Rails via authenticity tokens in forms.