O
O
O Di2015-08-31 22:42:33
Ruby on Rails
O Di, 2015-08-31 22:42:33

How to properly prioritize a task?

Decided to break the question How to make the "status" for the task? into two separate ones.
There are tasks - objects of the Task model. Tasks can have different priorities - "None", "High", "Medium", "Low".
So far done like this:
Added "priority" field

create_table "tasks", force: :cascade do |t|
  t.integer  "priority"
end

And through the view, when creating / changing a task, we select a priority
<%= simple_form_for @task do |f| %>
  <%= f.input :priority, collection: , selected: ["None"] %>
<% end %>

And how to do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TyzhSysAdmin, 2015-08-31
@insiki

Create another table for priorities and load names into collection from there - this will make it possible to add / change priorities (values) without interfering with the application structure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question