How do I stop controller execution after using redirect_to? (Using Rails)

前端 未结 5 753
日久生厌
日久生厌 2020-12-24 10:46

I have a controller with multiple actions that take :year and :month as attributes from the URL. I have made a private method check_date to check the date is valid and check

5条回答
  •  天涯浪人
    2020-12-24 11:47

    redirect_to just tells rails what to render when it finishes. Rails will get confused if you add other render or redirect_to directives after the one you really want, so just return from the controller after the redirect_to - it's the 'normal' rails way to do things.

提交回复
热议问题