petitviolet blog

    rails (1 posts)

    icon
    Written by petitviolet

    Call Another Controller Action In Rails

    2020-11-16Rails
    Implement a controller action depending on another controller without using inheritance and redirection
    Sometimes we want to reuse a controller's action in another controller for some reasons. We know redirect is an answer of that, however, there is no way to touch the response when using redirect, and it might be necessary to modify the response, such as transforming response body to another format.