Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8801841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:56:13+00:00 2026-06-14T00:56:13+00:00

Hi when I try to reset password I get this error: ArgumentError in PasswordResetsController#create

  • 0

Hi when I try to reset password I get this error:

ArgumentError in PasswordResetsController#create

wrong number of arguments (1 for 0)

app/models/user.rb:48:in create_remember_token
app/models/user.rb:40:in
send_password_reset
app/controllers/password_resets_controller.rb:7:in `create’

class PasswordResetsController < ApplicationController
  def new
  end

  def create
    user = User.find_by_email(params[:email])
    user.send_password_reset if user
    redirect_to root_url
  end

  def edit
    @user = User.find_by_password_reset_token!(params[:id])
  end

  def update
    @user = User.find_by_password_reset_token!(params[:id])
    if @user.password_reset_sent_at < 2.hours.ago
      redirect_to new_password_reset_path, :alert => "Password &crarr; 
        reset has expired."
    elsif @user.update_attributes(params[:user])
      redirect_to root_url, :notice => "Password has been reset."
    else
      render :edit
    end
end
end



class User < ActiveRecord::Base
  attr_accessible :email, :lname, :name, :password, :password_confirmation
  has_secure_password
  before_save { |user| user.email = email.downcase }
  before_save :create_remember_token

  validates :name, presence: true, length: { maximum: 50 }
  validates :lname, presence: true, length: { maximum: 50 }
  VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
  validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
                    uniqueness: { case_sensitive: false }
  validates :password, presence: true, :on => :create
  validates :password, length: { minimum: 6 }, :allow_blank => true
  validates :password_confirmation, presence: true, :on => :create



  def send_password_reset
    create_remember_token(:password_reset_token)
    self.password_reset_sent_at = Time.zone.now
    save!
    UserMailer.password_reset(self).deliver
  end

  private

    def create_remember_token
      self.remember_token = SecureRandom.urlsafe_base64
    end
end

Have anybody an Idea why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:56:15+00:00Added an answer on June 14, 2026 at 12:56 am

    found a solution in railscasts

    added to before_save remember_token and changed create_remember_token

    I don’t know it’s right? but it works

        class User < ActiveRecord::Base
      attr_accessible :email, :lname, :name, :password, :password_confirmation
      has_secure_password
    
      before_save { |user| user.email = email.downcase }
      before_save { create_remember_token(:remember_token) }
    
      validates :name, presence: true, length: { maximum: 50 }
      validates :lname, presence: true, length: { maximum: 50 }
      VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
      validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
                        uniqueness: { case_sensitive: false }
      validates :password, presence: true, :on => :create
      validates :password, length: { minimum: 6 }, :allow_blank => true
      validates :password_confirmation, presence: true, :on => :create
    
      def send_password_reset
        create_remember_token(:password_reset_token)
        self.password_reset_sent_at = Time.zone.now
        save!
        UserMailer.password_reset(self).deliver
      end
    
    
    
        def create_remember_token(column)
         begin
          self[column] = SecureRandom.urlsafe_base64
         end while User.exists?(column => self[column])
        end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I trying to create a reset password for my rails app; but when
I am trying to allow the user to reset their password using Devise's recoverable
To reset password, user should go to link that contains token: example.com/password-change/?token=8125b6da86694a19b5d76f30a04c9db8 In view
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]
try: html = urlopen('http://glbse.com/api/asset/' + asset.name) except: print 'error while updating the price of
try: recursive_function() except RuntimeError e: # is this a max. recursion depth exceeded exception?
Try as I might I cannot get my head around what the IteratorIterator class
I'm trying to write a password reset function for my site in CakePHP. I've
I am trying to get the contents of a webpage that requires a password

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.