Turbo Rails Flashcards

1
Q

What is the benefit of building a Ruby on Rails application with Turbo?

A

Turbo speeds up Rails applications, reduces the amount of JavaScript we have to write, and makes it easy to work with real-time features.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a single-page application?

A

A Single-Page Application (SPA) is a type of web application or website that interacts with the user by dynamically rewriting the current page, rather than loading entire new pages from the server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Since Rails 7, Invalid form submissions have to return a 422 status code for Turbo Drive to replace the <body> of the page and display the form errors. What is the alias for the 422 status code?

A

The alias for the 422 status code in Rails is :unprocessable_entity.

That’s why, since Ruby on Rails 7, the scaffold generator adds status: :unprocessable_entity to #create and #update actions when the resource couldn’t be saved due to an invalid form submission.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are Turbo Frames?

A

Turbo Frames are independent pieces of a web page that can be appended, prepended, replaced, or removed without a complete page refresh.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do Turbo Frames work?

A

When clicking on a link within a Turbo Frame, if there is a frame with the same id on the target page, Turbo will replace the content of the Turbo Frame of the source page with the content of the Turbo Frame of the target page

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens if when clicking on a link within a Turbo Frame, there is no Turbo Frame with the same id on the target page?

A

When clicking on a link within a Turbo Frame, if there is no Turbo Frame with the same id on the target page, Turbo will remove the content of the Turbo Frame from the source page and log an error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Turbo Drive is a feature of the Hotwire framework that gets installed by default in Rails 7 applications. What is it used for?

A

Turbo Drive intercepts link clicks and form submissions, fetching the new page via AJAX, and replacing the content of the current page. That means that our RoR CRUD application is already a single-page application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an AJAX (Asynchronous JavaScript and XML) request?

A

An AJAX request is a technique that allows web pages to fetch or send data from/to a server asynchronously, making applications more dynamic and responsive. It improves the user experience by updating only parts of a page instead of reloading the entire page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the concerns in Ruby on Rails?

A

Concerns are modules that allow you to share and reuse common code across multiple models or controllers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are helpers in Ruby on Rails?

A

Helpers are used to extract and share view-related logic in Rails. They are intended to keep your views clean by moving complex logic out of the view templates.

Helpers are modules that are automatically available in your view templates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly