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

  • Home
  • SEARCH
  • 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 8958933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:19:50+00:00 2026-06-15T15:19:50+00:00

I’m writing a simple test checking to see if my controller works, however my

  • 0

I’m writing a simple test checking to see if my controller works, however my tests keep returning

3) PasswordResetsController for checking update succeeds 
 Failure/Error: put :update, id: @user.password_reset_token
 TypeError:
   can't convert Symbol into Integer
 # ./app/controllers/password_resets_controller.rb:23:in `update'
 # ./spec/controllers/password_resets_controller_spec.rb:52:in `block (3 levels) in 
 <top (required)>'

My tests are as follows…

describe PasswordResetsController do

before do
  @user = FactoryGirl.create( :user )
end

context "for checking update succeeds" do
  before do
    @user.password_reset_token = "gB5KGF-3hC4RNHCK5niz9A"
    @user.password_reset_sent_at = Time.zone.now
    @user.save!(validate: false) 
    put :update, id: @user.password_reset_token
  end


  it { should assign_to(:user) }      
  it { should respond_with(:redirect) }
  it { should redirect_to(signin_path) }
  it { should set_the_flash.to("Password has been reset.")}

end

end

Here is a link to my Model https://github.com/thejourneydude/template/blob/master/app/models/user.rb

EDIT: It appears that the problem is originating from my controller. On my local server, I’m returned with

TypeError in PasswordResetsController#update

can't convert Symbol into String

Rails.root: /home/jason/ror/template
Application Trace | Framework Trace | Full Trace

app/controllers/password_resets_controller.rb:19:in `update'

My update action in my controller code is..

def update
  @user = User.find_by_password_reset_token!(params[:id])
  if @user.password_reset_sent_at && @user.password_reset_sent_at > 2.hours.ago
    redirect_to new_password_reset_path, flash: { error: "Password reset has expired" }
  elsif @user.update_attributes(params[:user])
    redirect_to root_url, flash: { success: "Password has been reset." }
  else 
    render :edit, flash: { error: "Hmm.. something went wrong. Let's try that again." }
  end
end

What’s wrong with my code and how do I fix it?

  • 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-15T15:19:51+00:00Added an answer on June 15, 2026 at 3:19 pm

    What happens if you change this line:

    redirect_to new_password_reset_path, flash[:error] = "Password reset has expired"
    

    to:

    redirect_to new_password_reset_path, flash: { error: "Password reset has expired" }
    

    ?

    My guess is that you should not be able to call flash[:error] = in the redirect_to since assignment in Ruby returns the value being assigned. redirect_to requires a hash as the second parameter, but it is being called as a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am writing an app with both english and french support. The app requests
I'm making a simple page using Google Maps API 3. My first. One marker
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all

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.