# Rails 3 route problem

**URL:** <https://www.ruby-forum.com/t/rails-3-route-problem/202983>\
**Category:** Rails\
**Created:** [February 10, 2011, 1:19am UTC](https://www.ruby-forum.com/t/rails-3-route-problem/202983 "2011-02-10T01:19:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 10, 2011, 1:19am UTC](https://www.ruby-forum.com/t/rails-3-route-problem/202983/1 "2011-02-10T01:19:12Z")

</div>

Original from here: Rails 3 route problem

Hello,

After solving the other problem with routes , now I have another one.

I have this route in my routes.rb:

match “user/create\_new\_password/:reset\_password\_key”  
=\>“users#create\_new\_password”, :via=\>[:post, :get],  
:as=\>:create\_new\_password  
I can test it in my functional tests like this:

test "should create new password " do  
post :create\_new\_password,  
{:user=\>{:password=\>“123456”, :password\_confirmation=\>“123456”},  
:reset\_password\_key=\>user.reset\_password\_key}  
end  
In my view, I have the following form:

=simple\_form\_for @user, :url=\>create\_new\_password\_path do |f|

=f.input :password, :label=\>I18n.t(“activerecord.attributes.user.email”)

=f.input :password\_confirmation,  
:label=\>I18n.t(“activerecord.attributes.user.password\_confirmation”)  
=f.submit I18n.t “activerecord.actions.user.create\_new\_password”

When I submit the form, I get:

No route matches “/user/create\_new\_password/  
OqQxYTgjYKxXgvbAsTsWtMnIpMOpsjCRzLGZmJZLSbYtjvcvdpO”  
The big string, is the reset\_password\_key.

I have tested it in functional tests with the same value for  
reset\_password\_key.

The relevant output for rake routes is:

create\_new\_password POST|GET /user/  
create\_new\_password/:reset\_password\_key(.:format)  
{:controller=\>“users”, :action=\>“create\_new\_password”}  
I’m missing something…

---

<div class="post-metadata">

**Author:** ![j-merrill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@j-merrill](https://www.ruby-forum.com/u/j-merrill)\
**Post date:** [February 10, 2011, 1:29am UTC](https://www.ruby-forum.com/t/rails-3-route-problem/202983/2 "2011-02-10T01:29:56Z")

</div>

since the routes match exactly, I think the problem is in the method. I  
haven’t used simple\_form yet so I don’t know what it does  
but you should check if it sets the method to PUT for existing records.

On Thu, Feb 10, 2011 at 8:17 AM, jm [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> =\>“users#create\_new\_password”, :via=\>[:post, :get],
> 
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid).  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–

---

<div class="post-metadata">

**Author:** ![j-merrill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/aeb1de/32.png) [@j-merrill](https://www.ruby-forum.com/u/j-merrill)\
**Post date:** [February 12, 2011, 7:26pm UTC](https://www.ruby-forum.com/t/rails-3-route-problem/202983/3 "2011-02-12T19:26:32Z")

</div>

Yeah, I was only allowing POST and GET on that route, Rails was  
looking for a PUT because the object user was not new.

Thanks

On Thu, Feb 10, 2011 at 12:28 AM, Jim Ruther N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > After solving the other problem with routes , now I have another one.  
> > test "should create new password " do
> 
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid).  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
Joo Miguel Pereira

> **[DropCatch.ai](https://dropcatch.ai/lander/jpereira.eu)**
>
> Bid on recently expired premium domains and backorder domains before they drop. Daily fresh drops across .it, .es, .eu, .be and more.
