Hi,
I have a resource map like this:
map.resources :users do |user|
user.resource :sreg10record
end
So a User is supposed to have (at most) one Sreg10record. The problem
is in the views. I tried following this tutorial:
which proposes something like:
<% form_for( [@user, @sreg10record] ) do |f| %>
However, doing that yields “undefined method `has_key?’ for
#Sreg10record:0xb6f47bc4”. So I tried
<% form_for( [:user, @sreg10record] ) do |f| %>
as intended for namespaced resources, however that causes the ID of
the record to be used in the URL, which then causes the controller to
fail when retrieving @user. Experiments with url_for (which appears to
be used by form_for anyway) or user_sreg10record_url(@user) failed in
more or less entertaining ways too. So, how do I make form_for
generate a valid path like “/users/<user_id>/sreg10record”?