Hello everybody,
I have a nested form and it works perfect, and then when i want to
show the fields from the nested form fail. And the navigator displays:
edit_member_responsible_url failed to generate from
{:controller=>“member/responsibles”, :action=>“edit”, :id=>nil},
expected: {:controller=>“member/responsibles”, :action=>“edit”}, diff:
{:id=>nil}
The code is:
the view for the nested forms.
<% form_for :profile, :url => member_profile_path(@profile), :html =>
{:method => :put, :multipart=>true} do |f| -%>
.
.
.
<% f.fields_for :responsibles do |responsible_form| %>
.
.
.
<div class="actions">
<%= submit_tag
I18n.t(‘tog_social.profiles.member.update_profile’), {:accesskey =>
“s”, :class=>“button mainaction”} %>
<% end -%>
<% end -%>
the view after submit the forms:
<[email protected] do |r|%>
Nombre: <%= r.responsible_name %>
<p><b>Email:</b> <%= r.responsible_email %></p>
<p><b>Telfono:</b> <%= r.responsible_tlf %></p>
<%= link_to I18n.t('tog_social.profiles.site.edit_responsible'),
edit_member_responsible_path(@responsible) %>
<hr class="wide" />
<% end%>
So the error is in the link to edit a responsible. And in the
controller i have:
class Member::ResponsiblesController < Member::BaseController
def edit
@responsible =
current_user.profile.responsibles.find(params[:responsible])
end
def update
responsible.update_attributes!(params[:responsibles])
responsible.save
flash[:ok] =
I18n.t(“tog_social.profiles.member.responsibles_created”)
redirect_to profile_path(profile)
end
end
and in the routes.rb
namespace(:member) do |member|
member.resources :profiles
member.resources :responsibles
So what is the problem?
thanks and apologize me.