Search
⌘K
    to navigateEnterto select Escto close

    Do not leave action implementation blank

    Let's look at the action edit in a controller.

    1def edit
    2end

    In the above method, it is not clear whether that method's implementation is complete or not, since developers sometimes forget to complete the method.

    Here is a way to remove that ambiguity.

    If the implementation is complete, then just add the word render.

    1def edit
    2  render
    3end

    Now, when one looks at the method, it's clear that the developer did not forget anything. The developer is explicitly saying that the only thing this method does is render the view.

    Previous
    Next