发送方法的参数 1 为 0 的错误数量 rails
Wrong number of arguments 1 for 0 for send method rails
这个问题在其他帖子里有过。我读过它们。但是其他问题中的问题,我在我的代码中找不到
这是我的看法
<%= simple_form_for :mail, url: forgot_pass_path, method: :post do |f| %>
<div class="a3" style="padding-top:20px;">
<center>
<div class="only-in-mobile">
<%= image_tag("Shijokes_Logo.png", alt: "Pets_Caricature", class: "img-responsive logo") %>
<!-- <img class="img-responsive logo" src="img/images/Shijokes_Logo.png" style=""> -->
</div>
<div style="padding-left:10%; padding-right:10%; padding-top:20%;">
<h2 style="font-size: 18px;
font-weight: 500;">Reset Password</h2>
<P class="" style="font-size: 13px;
font-weight: 400; color:#666; margin-bottom:20px;">Enter the email address associated with your <br/>account we'll email you a link to reset<br/> your password</P>
<div class="form-group">
<%= f.input :mail, required: true, label: false, input_html: {class: 'form-control', placeholder: 'Enter email'} %>
</div>
<input type="submit" name="commit" value="SEND RESET" class="blue-button">
</div>
</center>
</div>
<!-- forgot password -->
<% end %>
这是路线
post 'forgot_pass' => 'forgot_password#send'
这是控制器
class ForgotPasswordController < ApplicationController
def send
byebug
mail = params[:mail]
end
end
我收到的错误是
ArgumentError in ForgotPasswordController#send
wrong number of arguments (1 for 0)
啊! send
在ruby中有特殊的含义,即使用消息给对象。所以请不要将它用于控制器中的操作:|
似乎 send
被保留用于另一种方法
method( :send ).owner
=> Kernel
详细讨论here
这个问题在其他帖子里有过。我读过它们。但是其他问题中的问题,我在我的代码中找不到
这是我的看法
<%= simple_form_for :mail, url: forgot_pass_path, method: :post do |f| %>
<div class="a3" style="padding-top:20px;">
<center>
<div class="only-in-mobile">
<%= image_tag("Shijokes_Logo.png", alt: "Pets_Caricature", class: "img-responsive logo") %>
<!-- <img class="img-responsive logo" src="img/images/Shijokes_Logo.png" style=""> -->
</div>
<div style="padding-left:10%; padding-right:10%; padding-top:20%;">
<h2 style="font-size: 18px;
font-weight: 500;">Reset Password</h2>
<P class="" style="font-size: 13px;
font-weight: 400; color:#666; margin-bottom:20px;">Enter the email address associated with your <br/>account we'll email you a link to reset<br/> your password</P>
<div class="form-group">
<%= f.input :mail, required: true, label: false, input_html: {class: 'form-control', placeholder: 'Enter email'} %>
</div>
<input type="submit" name="commit" value="SEND RESET" class="blue-button">
</div>
</center>
</div>
<!-- forgot password -->
<% end %>
这是路线
post 'forgot_pass' => 'forgot_password#send'
这是控制器
class ForgotPasswordController < ApplicationController
def send
byebug
mail = params[:mail]
end
end
我收到的错误是
ArgumentError in ForgotPasswordController#send
wrong number of arguments (1 for 0)
啊! send
在ruby中有特殊的含义,即使用消息给对象。所以请不要将它用于控制器中的操作:|
似乎 send
被保留用于另一种方法
method( :send ).owner
=> Kernel
详细讨论here