Answer the question
In order to leave comments, you need to log in
Explain on your fingers how to create a status for an object?
Hello.
Let's say there is a note in the form of a task and you need to make several statuses for it, "in progress" and "completed". What is the best way to implement this?
Answer the question
In order to leave comments, you need to log in
Everything freed the head.
So so.
There are two, simple, options for implementing your task:
1. Add the "status" field to the model and implement select with predefined statuses in the form
2. the same thing, but create another "Status" model in the "ststus" field p.1 . store the "id" of the status
The second option is preferable, since it does not force you to add a new status to edit views or controllers if necessary, just add new statuses to the database.
quickly a project to figure out
https://github.com/POStroi/lavezzi1_toster
Well, no one bothers to put down the status with buttons, AJAX requests, and in general, whatever your heart desires :)
1. manually make fields "in progress", 'readyh' ...
2. google ruby state machine (ASM, Workflow gems)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question