1

我在控制器中的 if/else 条件没有被调用:

我的浏览页面:

 <%= form_tag password_resets_path, :method => :post do %>

   <%=  radio_button_tag :name,  :time, true %> 
      <strong>Send Password Reset Link to Mail </strong>
   <%=  radio_button_tag :name, :graph %>
      <strong> Get Recovery Code on Mobile </strong>

<%= submit_tag %>

在控制器中:

def create
    user = User.find_by_email(params[:email])
         if params[:name] == :time
            user.send_password_reset 

        elsif params[:name] == :graph
           user.send_password_mobile
        end

    redirect_to root_path, :notice => 'Instructions sent!'
end
4

0 回答 0