hello
i am having a bit of trouble with updating the values of a boolean field
in my database/model given the value returned by a check box
i am generating the check box as follows:
check_box(“user”, “enabled”)
which produces
no problems there - it is reading the value out of the model/database
and checking the box correctly
n.b. the database stores a 1 for true and 0 for false
however, if i uncheck the checkbox, for example, and update using this
method in my controller:
def update
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
#success
else
#failed
end
end
it doesn’t seem to commit the change
i have tried using the alternative check_box method specifying the
checked and unchecked values as “true” and “false” but this doesn’t work
either.
any ideas? thanks