Just briefly, why are the following three lines not identical in their impact?
if @controller.controller_name == \"projects\" || @controller.controller_name
Basically, == doesn't distribute over other operators. The reason 3 * (2+1) is the same as 3 * 2 + 3 * 1 is that multiplication distributes over addition.
The value of a || expression will be one of its arguments. Thus the 2nd statement is equivalent to:
if @controller.controller_name == "projects"
|| is of lower precedence than ==, so the 3rd statement is equivalent to:
if (@controller.controller_name == "projects") || "ports"