Search
⌘K
    to navigateEnterto select Escto close

    Do not use redirect in API

    1# do not do this
    2def destroy
    3  ....
    4  @user.destroy
    5  redirect_to :back
    6end

    In the above case redirect_to :back does not mean anything when you are dealing with API. The correct version would be

    1def destroy
    2  ....
    3  @car_alert.destroy
    4  render head: :no_content, status: :ok
    5end
    Previous
    Next