tomtt
August 21, 2008, 6:03pm
1
Hi
i have a 1-N Model: Company<>Division. everything is default. I want to
have a Division/new partial in the Company/show view. so what i did was
copying the new to _new and render it with:
Company/show:
Title:
<%=h @account.title %>
.....
<%= render :partial=>‘contacts/new’, :local=>@contact=Contact.new %>
…
but now i dont know hoe to get the @acount_id into the Division-Model as
foreign key!?
what do i need to do here?
thx
tomtt
August 21, 2008, 8:40pm
2
could you:
<%= render_partial ‘contacts/new’, nil, ‘contact’ => Contact.new,
‘account’ => @account.id %>
tomtt
August 21, 2008, 9:07pm
3
i tried:
<%= render :partial=>‘contacts/new’, nil, :contact=> Contact.new,
:account=> @account.id %>
but this didnt work:
compile error
/var/www/railapps/TEST5/app/views/accounts/show.html.erb:8: syntax
error, unexpected ‘,’, expecting tASSOC
_erbout.concat(( render :partial=>‘contacts/new’, nil, :contact=>
Contact.new, :account=> @account.id ).to_s); _erbout.concat “\n”
^
/var/www/railapps/TEST5/app/views/accounts/show.html.erb:8: syntax
error, unexpected tASSOC, expecting tCOLON2 or ‘[’ or ‘.’
_erbout.concat(( render :partial=>‘contacts/new’, nil, :contact=>
Contact.new, :account=> @account.id ).to_s); _erbout.concat “\n”
tomtt
August 22, 2008, 4:55am
4
Any difference if you take that nil arg out of there?
If not, maybe this would work:
<%= render :partial=>‘contacts/new’, :contact => Contact.new(:account_id
=> @account.id ) %>
?
-Roy