Topic: Checkboxes in Todo list application
I'm getting into RoR quite a bit now and enjoying it for the most part . I've started off making a todo List with the adding and editing of items. I am however having a little trouble with checkboxes. I have a field called completed in my database which can either be 0 (Not completed) or 1 (completed) which works well with checkboxes as I understand because 0 will give an unchecked box and 1 a checked box. So this is my _form.rhtml file in the view folder: http://pastie.caboo.se/42290 . This works because I can check the box and omit the changes in the edit view and this will change the record in the database. It also mirrors the changes when I go to the 'Show' page of the particular item, however it is not mirrored in the list view with the correct checkbox. Any ideas why? Here is the code in list.rhtml: http://pastie.caboo.se/42291
Rails is recognising it when it has been set to completed as you can see in this screenshot (list): http://www.mholland.org/list.png . But not displaying the right checkbox. Here in the edit view however, it is displaying the right checkbox. http://www.mholland.org/edit.png .
Any ideas/help/responses are greatly appreciated.
Thanks very much
| My blog |