You are previewing Rails 3 in Action.

Rails 3 in Action

Cover of Rails 3 in Action by Ryan Bigg... Published by Manning Publications
O'Reilly logo

Chapter 10. Tracking state

This chapter covers

  • Adding a state-tracking ability to a model
  • Using callbacks within Active Record
  • Preventing basic form hacking

In a ticket-tracking application such as Ticketee, tickets aren’t there to provide information about a particular problem or suggestion; rather, they’re there to provide the workflow for it. The general workflow of a ticket is that a user will file it and it’ll be classified as a “new” ticket. When the developers of the project look at this ticket and decide to work on it, they’ll switch the state on the ticket to “open” and, once they’re done, mark it as “resolved.” If a ticket needs more information on it then they’ll add another state, such as “needs more info.” A ticket could also ...

The best content for your career. Discover unlimited learning on demand for around $1/day.