Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Rails allows us to write very concise code hiding a lot of the complexity. However, it's common to face situations that require us to write more complex code on our own, and sometimes we forget a little about what Rails can do for us. We are going through some Rails features that people might not be aware of, talking about Active Record queries, custom template handlers, routing niceties, view helpers and more, to learn how these tricks can help simplifying complex code on our apps. Carlos (@cantoniodasilva) hacks beautiful code at Plataformatec, a consultancy firm based in Brazil, and is member of the Rails Core Team. He enjoys writing about a variety of subjects at the company's blog, and helping maintaining open source projects like Simple Form and Devise. Help us caption & translate this video! http://amara.org/v/FG1a/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the RailsConf 2014 talk titled "Tricks That Rails Didn't Tell You About," Carlos Antonio da Silva shares lesser-known features and best practices in Ruby on Rails that can simplify complex code. He begins by highlighting the complexity that often arises in Rails projects, emphasizing that many developers may overlook existing tools and features provided by Rails. ### Key Points Discussed: - **Complexity in Rails Applications:** Carlos reviews common challenges such as duplicated code, large controllers, and complex methods that developers face when working with Rails. - **Active Record Enhancements:** He introduces several Active Record features, such as the `change` method for migrations that can simplify migrations without needing to specify column types, and the use of `merge` to reduce duplication in query conditions. - **Eager Loading Strategies:** Carlos discusses the importance of optimizing database queries through Active Record methods like `includes`, `preload`, and their performance implications. - **Action View and Helpers:** He covers the use of helpers for rendering collections and controlling output, including strategies for rendering empty collections effectively. - **Internationalization (i18n):** Insights on best practices for translating strings in views without introducing security vulnerabilities are provided. - **Benchmarking:** Carlos presents a built-in benchmarking method in Active Record that allows developers to log the performance of database queries, providing important metrics for optimization. - **Using Active Model:** He explains how to leverage Active Model for validations and form handling to make non-persistent models behave like Active Record, streamlining the development process. - **Advanced Routing Techniques:** The session touches on routing parameters and handling redirects more efficiently with interpolation. - **Useful Development Practices:** Carlos encourages leveraging Rails console features, such as the sandbox mode for testing without permanent changes, and the use of annotations for marking code improvements or optimizations needed. ### Conclusions and Takeaways: - Developers often miss using Rails' built-in features which can lead to complexity and inefficiency. - Understanding and adopting these lesser-known tricks and features can significantly enhance productivity and maintainability of Rails applications. - Continuous learning and sharing of knowledge within the Rails community can uncover new ways to utilize Rails effectively. In conclusion, Carlos emphasizes that before drafting custom implementations, developers should consider if Rails offers an existing feature that could simplify their work. He encourages a culture of sharing findings and improvements within the community to enhance overall development practices.
Suggest modifications
Cancel