As part of a wider application, I have a todo list set up with boolean
column indicating if the todo is complete or not. It defaults to
false to indicate not complete.
I'm using a check box that calls a defined action called
complete_item. At the moment it looks like this:
class TodosController < ApplicationController
...
def complete_item
@todo = @matter.todos.find_by_id(params[:id])
@todo.complete = true
@todo.save
...
end
I have also tried the following various methods, none of which work:
The log messages (or their absence) will help you understand if your
failure to update is related to validations.
How are you defaulting complete to false? Is it the default value
(db) or via code?
@todo.update_attributes(:complete, true)
^ This one doesn't work because update_attributes (plural) takes a
hash. Make it singular (update_attribute) and you might have success.