Routing woes

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?

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.