# Routes and IDs above 9

**URL:** <https://www.ruby-forum.com/t/routes-and-ids-above-9/133378>\
**Category:** Rails\
**Created:** [March 31, 2008, 1:51am UTC](https://www.ruby-forum.com/t/routes-and-ids-above-9/133378 "2008-03-31T01:51:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mozmonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@Mozmonkey](https://www.ruby-forum.com/u/Mozmonkey)\
**Post date:** [March 31, 2008, 1:51am UTC](https://www.ruby-forum.com/t/routes-and-ids-above-9/133378/1 "2008-03-31T01:51:22Z")

</div>

I feel really silly right now but can’t get past a weird error:

user\_update\_url failed to generate from  
{:controller=\>“users”, :id=\>10, :action=\>“update”}, expected:  
{:controller=\>“users”, :action=\>“update”}, diff: {:id=\>10}

Extracted source (around line #7):

4:

  
5:  
6: 
  
7: \<% form\_tag user\_update\_url(:id =\> self.current\_user.id), :method  
=\> ‘post’, :class =\> ‘editing inline’ do %\>  
8: 
## Welcome \<%= current\_user.name %\>
  
9: 
  
10: \<% if current\_user.attribute\_present? ‘tagline’ %\>

The really weird problem is that I only get this error when the user  
has an ID over 9. The ID is set as a bigint in mysql.

What should I be looking for to solve this problem? The route for  
that URL looks like this:

map.user\_update ‘users/:id/update’, :controller =\> ‘users’, :action =\>  
‘update’, :requirements =\> { :id =\> /\d/ }

Thanks,  
Jeremy

---

<div class="post-metadata">

**Author:** ![Mozmonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@Mozmonkey](https://www.ruby-forum.com/u/Mozmonkey)\
**Post date:** [March 31, 2008, 2:01am UTC](https://www.ruby-forum.com/t/routes-and-ids-above-9/133378/2 "2008-03-31T02:01:20Z")

</div>

I’ve figured it and and feel pretty stupid. 😉 Did you catch my  
problem? It’s the routes requirements was looking for a single digit:

requirements =\> { :id =\> /\d/ }

The change was to simply add a “+”:

requirements =\> { :id =\> /\d+/ }

Ha ha.

---

<div class="post-metadata">

**Author:** ![Mozmonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@Mozmonkey](https://www.ruby-forum.com/u/Mozmonkey)\
**Post date:** [March 31, 2008, 7:54am UTC](https://www.ruby-forum.com/t/routes-and-ids-above-9/133378/3 "2008-03-31T07:54:37Z")

</div>

🙂

I both love it and hate it when I do things like that.

The 9 was a big giveaway, though. It would have been my first guess: a  
constraint on a single digit. Glad you caught it, though. Now you are  
your own mentor!

-Danimal
