Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Layered Design for Ruby on Rails Applications

You're reading from  Layered Design for Ruby on Rails Applications

Product type Book
Published in Aug 2023
Publisher Packt
ISBN-13 9781801813785
Pages 298 pages
Edition 1st Edition
Languages
Author (1):
Vladimir Dementyev Vladimir Dementyev
Profile icon Vladimir Dementyev

Table of Contents (20) Chapters

Preface 1. Part 1: Exploring Rails and Its Abstractions
2. Chapter 1: Rails as a Web Application Framework 3. Chapter 2: Active Models and Records 4. Chapter 3: More Adapters, Less Implementations 5. Chapter 4: Rails Anti-Patterns? 6. Chapter 5: When Rails Abstractions Are Not Enough 7. Part 2: Extracting Layers from Models
8. Chapter 6: Data Layer Abstractions 9. Chapter 7: Handling User Input outside of Models 10. Chapter 8: Pulling Out the Representation Layer 11. Part 3: Essential Layers for Rails Applications
12. Chapter 9: Authorization Models and Layers 13. Chapter 10: Crafting the Notifications Layer 14. Chapter 11: Better Abstractions for HTML Views 15. Chapter 12: Configuration as a First-Class Application Citizen 16. Chapter 13: Cross-Layers and Off-Layers 17. Index
18. Gems and Patterns 19. Other Books You May Enjoy

Filter objects or user-driven query building

If we continue our web development simplification that we started at the beginning of this chapter, we can say that besides forms and links, we build data tables and lists. For example, a list of repositories on GitHub or an inbox in a web email client. What do these interfaces have in common? They all have filtering, sorting, and search controls available to users. Whenever we display a large amount of homogeneous data to a user, we want to make their life easier and allow narrowing down the scope.

Such user-driven querying requires processing input parameters and applying transformations to the base dataset based on the values provided. Let’s see how we can implement this in a Ruby on Rails application.

Filtering in controllers

Just like before, we start with a pure Rails way of solving this problem. For parameter-based filtering, that means putting transformation logic right into the controller class.

Let’s consider...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}