# Form object suddenly can't read my routes?

**URL:** <https://www.ruby-forum.com/t/form-object-suddenly-cant-read-my-routes/141809>\
**Category:** Rails\
**Created:** [June 30, 2008, 7:02pm UTC](https://www.ruby-forum.com/t/form-object-suddenly-cant-read-my-routes/141809 "2008-06-30T19:02:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 30, 2008, 7:02pm UTC](https://www.ruby-forum.com/t/form-object-suddenly-cant-read-my-routes/141809/1 "2008-06-30T19:02:56Z")

</div>

I’m building a large application where I do everything exactly the  
same across most controllers and views. All of them have worked so far  
but now, I’m geting the strangest behaviour out of one. I am calling  
the same \_form.html.erb that fails on either the new or edit action.  
I am certain my routes are built correctly but I seem to receive a  
message when I’m invoking the form object that it can’t find the  
route?

NoMethodError in Evidence/etxcodes#edit

Showing evidence/etxcodes/edit.html.erb where line #5 raised:

undefined method `etxcode\_path’ for #ActionView::Base:0x554bc6c

Extracted source (around line #5):

2:  
3: \<%= error\_messages\_for :etxcode %\>  
4:  
5: \<% form\_for(@etxcode) do |form| %\>  
6: \<%= form.error\_messages %\>  
7:  
8:

Parameters:

{“account\_id”=\>“2”,  
“id”=\>“1”}

My edit method is pretty standard and is exactly like all the others

def edit  
@title = “Edit Transaction Code for: #{@account.name}”  
if current\_user.evid\_auth \> MAX\_CONTROL  
@etxcode = @account.etxcodes.find(params[:id])  
else  
flash[:notice] = “You are not authorized to perform this task”  
redirect\_back\_or\_default account\_etxcodes\_path(@account)  
return false  
end  
end

Actually the functional route that the form object should be using is  
edit\_account\_etxcode\_path(@account, @etxcode).  
Could anyone recommend how they’d this curious problem?  
Thank you,  
Kathleen

P.S. All these other routes work correctly;  
map.resources :accounts, :controller =\> ‘admin/accounts’ do |  
account|  
account.resources :agencies, :name\_prefix =\>  
“account\_”, :controller =\> ‘evidence/agencies’  
account.resources :incidents, :name\_prefix =\>  
“account\_”, :controller =\> ‘evidence/incidents’  
account.resources :ecategories, :name\_prefix =\>  
“account\_”, :controller =\> ‘evidence/ecategories’  
account.resources :etxcodes, :name\_prefix =\>  
“account\_”, :controller =\> ‘evidence/etxcodes’  
account.resources :ecases, :name\_prefix =\>  
“account\_”, :controller =\> ‘evidence/ecases’
