Can I use redirect_to in a view in RoR?

后端 未结 5 1628
闹比i
闹比i 2021-01-04 00:28

In my app, I\'ve got a little box that appears on every page, checking on the status of requests made by the user. If a request is accepted at any time, then the user should

5条回答
  •  感情败类
    2021-01-04 01:09

    redirect_to is a method of ActionController::Base Class so you can not use it in ActionView.

    You can try following

    <% if w.accepted == true  %>
      
    <% end %>
    

    Edited for the email parameter

    window.location.href="/logins/sign_up?email=<%= w.email %>"
    

    Sorry i don't know if there is anything in ruby for that.

提交回复
热议问题