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 8043075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:47:49+00:00 2026-06-05T04:47:49+00:00

I have an interesting situation which leaves me scratching my head. I’ve created a

  • 0

I have an interesting situation which leaves me scratching my head.
I’ve created a controller (without a model) to generate password resets. I’ve defined a RESTful route to the controller:

routes.rb

resources :password_resets

I’ve created some action on the controller, in particular my edit action:

password_resets_controller.rb

class PasswordResetsController < ApplicationController
  # code omitted
  def edit
    @user = User.find_by_password_reset_token!(params[:id])
  end
  # code omitted
end

The user can access the edit from the email that I send to the user:

password_reset.html.haml

%p To reset your password, click the URL below.
= edit_password_reset_url(@user.password_reset_token)

So far so good, I’ve managed to use the code.
Then I have the spec that tests my mailer:

  describe "password reset" do
    let(:user) { FactoryGirl.create(:user) }
    let(:mail) { UserMailer.password_reset(user) }

    it "sends user password reset url" do
      mail.to.should eq([user.email])
    end
  end

Surprisingly, I get the following:

 Failure/Error: let(:mail) { UserMailer.password_reset(user) }
 ActionView::Template::Error:
   No route matches {:action=>"edit", :controller=>"password_resets"}
 # ./app/views/user_mailer/password_reset.html.haml:5:in `_app_views_user_mailer_password_reset_html_haml__1760284087840822602_11954840'
 # ./app/mailers/user_mailer.rb:7:in `password_reset'

Yet there is a route match, at least by looking at my routes:

 password_resets GET    /password_resets(.:format)             password_resets#index
                       POST   /password_resets(.:format)             password_resets#create
    new_password_reset GET    /password_resets/new(.:format)         password_resets#new
   edit_password_reset GET    /password_resets/:id/edit(.:format)    password_resets#edit
        password_reset GET    /password_resets/:id(.:format)         password_resets#show
                       PUT    /password_resets/:id(.:format)         password_resets#update
                       DELETE /password_resets/:id(.:format)         password_resets#destroy

What could possible go wrong in my test/routes?

Many thanks.

  • 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-05T04:47:50+00:00Added an answer on June 5, 2026 at 4:47 am

    Check if Factory user has password_reset_token. Most likely it is nil, same routing error you can get for any edit_something_url(nil)

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

Sidebar

Related Questions

I have an interesting scenario. I have a task model which has a task
I'm working with vector now and I have an interesting situation which I need
I have an interesting situation - I have a table row which, currently, shows
I have an interesting situation that EMF forced me into: abstract class AbstractDog{ ...
I have an interesting dilemma to which, I hope, someone may have an answer.
I have an interesting situation, well it's probably not that unique at all, but
We've run into an interesting situation that needs solving, and my searches have turned
I have an awkward situation in which I have a 32-bit lib that must
I have an interesting situation on my hands, and I'm not quite sure how
I have a situation where there is a corrupt WAV file from which I'm

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.