More work on todo app
Today I worked some more on the to do list app. I wanted to add a default value to the
:done attribute so that any time a new task is created it is flagged as not yet completed. I liked the logic of doing this rather than leaving it as nil, but also I wanted to use the value to use in my model.
With this migration set, each new record created will return
:done => false. After this, I added a
pending? method to the model to check if there exist any created tasks that have
:done set to
Now, if i utilize this, I can get a boolean response to the question if there are any pending tasks. Finally, I utilized this method in order to display a table pending tasks or a message informing the user that there are no pending tasks.
I have much more to do but I like where this is going so far. I’m going to add a user model next along with more refactoring where necessary.