Fix implied layout detection for anonymous controllers

When creating an anonymous subclass of a controller,
`_write_layout_method` wasn't able to find a layout path even if a
parent controller had one that could be used. Now, the method will call
`super` if the current controller has no name.

In a related issue, we switch to using `anonymous?` rather than checking
only for `name` in order to be compatible with Ruby < 1.9 where anonymous
class names are set to the empty string rather than `nil`.