发送方法轨道的参数1为0表示错误

时间:2016-06-04 13:14:53

标签: ruby-on-rails simple-form

在其他帖子中,这个问题一直存在。我读过它们。但是在其他问题上的问题,我在我的代码中找不到

这是我的观点

 <%= 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)

2 个答案:

答案 0 :(得分:3)

似乎send保留了另一种方法

method( :send ).owner
=> Kernel

详细讨论here

答案 1 :(得分:1)

哎呀! <!DOCTYPE html> <html> <head> <title>Curiosity Killed the Cat</title> <!-- But Satisfaction Brought it Back. --> </head> <body> <h1 style="font-size:160%;">If Curiosity Can Kill, Then i'm Not Afraid to Die.</h1> <hr> <h2>Upload Number Two 6/4/16</h2> <a href="aceidaltest.comlu.com/directories/">Click here for a list of older posts!</a> <p> </p> <pre> There have been</pre> <!-- START OF HIT COUNTER CODE --><br><script language="JavaScript" src="http://www.counter160.com/js.js?img=15"></script><br><a href="https://www.000webhost.com"><img src="http://www.counter160.com/images/15/left.png" alt="Free web hosting" border="0" align="texttop"></a><a href="http://www.hosting24.com"><img alt="Web hosting" src="http://www.counter160.com/images/15/right.png" border="0" align="texttop"></a><!-- END OF HIT COUNTER CODE --> <pre> different users that have visited this website.</pre> </body> <!-- Follow Button --> <a href="https://twitter.com/aceidal" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @aceidal</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); </script> <!-- Tweet Button --> <a href="https://twitter.com/share" class="twitter-share-button" data-text="Check out this website/blog!" data-size="large" data-related="aceidal" data-hashtags="satisfactionbroughtitback">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs'); </script> </html> 在ruby中具有特殊含义,即将消息用于对象。所以请不要将它用于控制器中的操作:|