For a Rails 3.0 Todo app, I have a Tasks model with a Status field. What\'s the best way to store the Status field data (field type) and still display a human-r
The easiest thing to do would be to just store the actual strings in the field instead of adding another table. Depending on your point of view this is either a bad idea as your database will not be sufficiently normalized or a great idea as your app is now more efficient for being normalized.
If you opt to not do that and to keep the values in a separate table; you need to setup the relationships in the model.
class Task < ActiveRecord::Base
has_one :status
end
class Status < ActiveRecord::Base
belongs_to :tasks
end
Then in your view you can reference the value by:
<%= task.status %>