Search code examples
ruby-on-railssimple-form

Wrong number of arguments 1 for 0 for send method rails


This question has been there, in other posts. I have read them. But the problems in other questions, I cannot find in my code

Here is my view

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

Here is the route

post 'forgot_pass' => 'forgot_password#send'

Here is the controller

class ForgotPasswordController < ApplicationController

  def send
    byebug
    mail = params[:mail]
  end


end

The error I am getting is

ArgumentError in ForgotPasswordController#send
wrong number of arguments (1 for 0)

Solution

  • Argh! send has a special meaning in ruby, i.e., to use messages to objects. So please don't use it for actions in controller :|