© Greg Donald 2024
G. DonaldHands-on Test-Driven Developmenthttps://doi.org/10.1007/978-1-4842-9748-3_10

10. Page Tags

Greg Donald1  
(1)
Clarksville, TN, USA
 

In our previous chapter, we built out features for our Page objects. We added a way to search for pages by keyword and a way to look up archives of pages. We did this through a “search service,” which aided in separating our controller logic from our model logic.

In this chapter, we’ll add other features to our pages. We’ll add the ability to create and tag pages to categorize them.

Adding Page Tags

First, we want to add the ability to add tags to our Page records. Tags are a way to categorize our pages. Instead of using a gem such as acts-as-taggable-on, we’re going to implement our own tagging ...

Get Hands-on Test-Driven Development: Using Ruby, Ruby on Rails, and RSpec now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.