dijeron (3) [Avatar] Offline
#1
in listing 8.16 on page 202 the following code

<%= check_box_tag "permissions[#{project.id}][#{name}]", <br /> @ability.can?(name.to_sym, project) %>

should be:

<%= check_box_tag "permissions[#{project.id}][#{name}]", "", <br /> @ability.can?(name.to_sym, project) %></td>

i.e. a second argument needs to be inserted (the empty string will suffice), and the boolean expression moved to third place.

Even though the tests pass with the book's code, the interface never sets any checkboxes as checked. Permissions can be set, but they are shown incorrectly in the template and therefore pressing update twice will delete all permissions, no matter what they were before.

This error isn't caught by the cucumber or rspec tests since they don't test the test that permissions are shown correctly in the template.