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: <p> <b>Title:</b> <%=h @account.title %> </p> ..... <%= 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
could you: <%= render_partial ''contacts/new'', nil, ''contact'' => Contact.new, ''account'' => @account.id %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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"
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
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
-----Original Message-----
From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
[mailto:rubyonrails-talk@googlegroups.com] On Behalf Of Tom Tom
Sent: Thursday, August 21, 2008 12:08 PM
To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: [Rails] Re: has_many show partial new foreign key - help
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"
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---