KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jun-30 17:02 UTC
Form object suddenly can''t read my routes?
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''
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---