Get an improved navigation experience with a Chrominium based browser.
Dismiss
Ruby Video
Talks
Speakers
Events
Leaderboard
Sign in
Talks
Speakers
Events
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
RailsConf 2019 - Zeitwerk: A new code loader by Xavier Noria _______________________________________________________________________________________________ Cloud 66 - Pain Free Rails Deployments Cloud 66 for Rails acts like your in-house DevOps team to build, deploy and maintain your Rails applications on any cloud or server. Get $100 Cloud 66 Free Credits with the code: RailsConf-19 ($100 Cloud 66 Free Credits, for the new user only, valid till 31st December 2019) Link to the website: https://cloud66.com/rails?utm_source=-&utm_medium=-&utm_campaign=RailsConf19 Link to sign up: https://app.cloud66.com/users/sign_in?utm_source=-&utm_medium=-&utm_campaign=RailsConf19 _______________________________________________________________________________________________ In this talk we'll introduce Zeitwerk, the new code loader for gems and apps that is going to be the default in Rails 6. We'll cover what motivated me to work on it, which are the issues in Rails autoloading and why is it fundamentally limited, usage by gems, and interesting aspects of the implementation.
Date
Summary
Markdown supported
The video "Zeitwerk: A new code loader" features Xavier Noria's presentation at RailsConf 2019, where he introduces Zeitwerk, the new default code loader for Rails 6. Noria discusses the inadequacies of the previous Rails autoloading mechanism and how Zeitwerk aims to resolve these issues. Key Points Discussed: - **Introduction to Zeitwerk**: Zeitwerk is a gem that provides autoloading, eager loading, and reloading of code, designed to function independently of Rails and with any Ruby project. It is built on a strict project structure where file names correspond to constant paths. - **Implementation and Usage**: The basic usage involves setting up Zeitwerk by specifying the root directories of the project, allowing developers to instantly have autoloading capabilities. Noria emphasizes that this structure helps to maintain cleanliness and eases the loading process. - **Eager Loading**: Emphasizing performance, eager loading is explained as a method to load all code at boot-up, ensuring that everything required is available when needed. This is particularly beneficial for Rails applications in a production environment. - **Comparison with Existing Autoloading**: The session outlines historical issues with Rails' traditional autoloading that led to the development of Zeitwerk. These issues included fragile requires, potential name errors, and limitations tied to constant resolution. - **Enhancements Over Old Methods**: Zeitwerk employs a module autoload technique instead of Rails’ previous methods, allowing for better management of dependencies and a reduction of issues stemming from module loading failures or overrides. This change dramatically simplifies the coding process and adheres to Ruby’s standard practices. - **Integration in Rails 6**: Zeitwerk will be implemented by default in new Rails 6 applications, allowing users to eliminate old require dependencies without needing explicit requires. Noria defines steps for upgrading existing Rails applications to adopt Zeitwerk seamlessly. In conclusion, Zeitwerk resolves many long-standing issues with Rails autoloading, simplifies development, enhances application performance, and maintains compatibility across various Ruby project structures. Developers transitioning to Rails 6 should expect a cleaner and more efficient coding experience, propelling Ruby development further.
Suggest modifications
Cancel