# Routing woes

**URL:** <https://www.ruby-forum.com/t/routing-woes/170637>\
**Category:** Rails\
**Created:** [June 19, 2009, 11:00pm UTC](https://www.ruby-forum.com/t/routing-woes/170637 "2009-06-19T23:00:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [June 19, 2009, 11:00pm UTC](https://www.ruby-forum.com/t/routing-woes/170637/1 "2009-06-19T23:00:59Z")

</div>

I am getting this error following an update:

currency\_url failed to generate from  
{ :action=\>“show”,  
:id=\>#\<Currency id: 138, currency\_code: “”, currency\_name: “”,…,  
changed\_by: “not available”\> :controller=\>“currencies”},

expected:  
{ :action=\>“show”, :controller=\>“currencies”},

diff:  
{ :id=\>#\<Currency id: 138, currency\_code: “”, currency\_name: “”,…,  
changed\_by: “not available”\>} (ActionController::RoutingError)

Now, this particular model has the to\_params methiod defined::

def to\_param  
currency\_code  
end

So, I am wondering if this has anything to to with my difficulty. The  
routing for this controller is:

map.resources :currencies

And the update method simply does this:

…  
if @currency.save  
flash[:notice] = ‘Currency was successfully updated.’  
format.html { redirect\_to(@currency) }  
…

So, what am I doing wrong?

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [June 19, 2009, 11:22pm UTC](https://www.ruby-forum.com/t/routing-woes/170637/2 "2009-06-19T23:22:59Z")

</div>

James B. wrote:

> I am getting this error following an update:  
> …  
> So, what am I doing wrong?

Bad data in DB and no check for nil in view.
