Jorge Manrubia - Making a difference with Turbo - Rails World 2023

3 min read 6 months ago
Published on Apr 22, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Step-by-Step Tutorial: Making a Difference with Turbo in Rails

  1. Introduction to Turbo in Rails:

    • Turbo is a feature in Rails that enhances web page rendering by replacing the body of an existing document with new content instead of loading a new HTML document.
    • Turbo aims to improve responsiveness and UI fidelity without sacrificing the traditional HTTP request full-page response programming model.
  2. Initial Reaction and Evolution:

    • Initially, the speaker was disappointed with Turbo Links in 2012 as he believed in single-page applications.
    • After years of exploring different approaches, the introduction of Stimulus in 2018 made him appreciate the benefits of Turbo and Hotwire.
  3. Programming Happiness with Turbo:

    • Turbo prioritizes programmer happiness by offering a simple and productive programming model.
    • The speaker emphasizes that Rails' default behavior with Turbo is highly efficient and enjoyable for developers.
  4. Enhancements with Turbo:

    • Turbo introduced new tools like Turbo Stream Actions and Turbo Frames for higher fidelity updates in applications.
    • These features enhance the user experience without compromising the programming model.
  5. Implementing Turbo in a Calendar Application:

    • The speaker worked on a calendar application at 37 signals using Turbo's default full-body replacement approach.
    • The application started development in February with a focus on using Turbo for seamless updates and interactions.
  6. Challenges with Partial Updates and Broadcasting Changes:

    • Complex partial updates in a calendar application led the speaker to explore alternatives like Morphing from Phoenix LiveView.
    • Broadcasting changes in the application posed a challenge due to the complexity of individual stream actions.
  7. Introducing Morphing and Page Refresh Actions:

    • Morphing technology was implemented to simplify partial updates and enhance the user experience during page refreshes.
    • A new standard page refresh action was introduced to broadcast changes across browser sessions effectively.
  8. Simplifying Broadcasting Changes:

    • The new broadcasting system streamlined the process of broadcasting changes in the calendar application.
    • By leveraging Turbo's features, the application could efficiently handle dynamic updates and interactions.
  9. Enhancements and Customization with Turbo:

    • Turbo's attributes like turbo-permanent and turbo-frames were utilized to maintain screen state and reload specific elements during page refreshes.
    • The speaker emphasized the importance of declarative configuration and the seamless integration of Turbo features in Rails applications.
  10. Future Outlook and Conclusion:

    • The speaker highlighted the importance of prioritizing programming happiness and leveraging Turbo's capabilities for efficient web application development.
    • The ongoing improvements in Turbo aim to enhance the default user experience and provide options for higher fidelity updates.

By following these steps, you can understand the evolution of Turbo in Rails and how to implement its features to enhance the user experience in web applications.