O
O
O Di2015-08-23 18:39:41
Ruby on Rails
O Di, 2015-08-23 18:39:41

How to make a “status” for a task?

There are tasks - objects of the Task model. Tasks can have a status: "in progress", "pending", "completed" (maybe some other).
1. Add a "status" field to the tasks table and describe methods for changing the status in the model and use them in views?
2. Or create a "Status" model with the "title" field, make a connection through the 3rd table:

class Task 
habtm :statuses

class Status 
habtm :tasks

Then create a controller and add statuses through written views or admin?
How are things like this done in practice?
On the one hand, from the course on relational databases at the university, I remember that data should not be repeated, normalization, everything, on the other hand, isn't it too much to create just a few records?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Demidenko, 2015-08-23
@insiki

Maybe the final autovams gem aasm will do

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question