I want to render more than one partial in this code: render :partial => ''project_version'' how can I do this? -- 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 -~----------~----~----~----~------~----~------~--~---
Render the other partial inside that partial. ----- Ryan Bigg Freelancer http://frozenplague.net On 31/12/2008, at 4:54 PM, Zhao Yi wrote:> > I want to render more than one partial in this code: > > render :partial => ''project_version'' > > how can I do this? > -- > 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 -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> Render the other partial inside that partial. > ----- > Ryan Bigg > Freelancer > http://frozenplague.netSorry, I am confused. This piece of code is my case: <tr> <td>Version:</td> <td id="project_version"> <%= render :partial=>''project_version''%> </td> </tr> <tr> <td>View Name:</td> <td id="view_name"><%= render(:partial=>''view_name'') %></td> </tr> You want me to render "view_name" inside "project_version", how can I do this in _project_version.html.erb? -- 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 -~----------~----~----~----~------~----~------~--~---
Your code will does this job. Is your problem some thing like: you have a.rhtml file int that you have to show _b.rhtml file contents as well as _c.rhtml contents? Then write your code like this: == This is a.rhtml file <%= render :partial=>''b''%> <%= render :partial=>''c'' %> On Wed, Dec 31, 2008 at 4:37 PM, Zhao Yi <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > Ryan Bigg wrote: > > Render the other partial inside that partial. > > ----- > > Ryan Bigg > > Freelancer > > http://frozenplague.net > Sorry, I am confused. > > This piece of code is my case: > > <tr> > <td>Version:</td> > <td id="project_version"> > <%= render :partial=>''project_version''%> > </td> > </tr> > > <tr> > <td>View Name:</td> > <td id="view_name"><%= render(:partial=>''view_name'') %></td> > </tr> > > You want me to render "view_name" inside "project_version", how can I do > this in _project_version.html.erb? > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ramu --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ramu wrote:> Your code will does this job. > > Is your problem some thing like: > you have a.rhtml file > int that you have to show _b.rhtml file contents as well as _c.rhtml > contents? > > Then write your code like this: > > == This is a.rhtml file > > <%= render :partial=>''b''%> > > <%= render :partial=>''c'' %> > -- > RamuBut how can I handle the <tr> element? the two partial should be in different <tr> element. -- 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 -~----------~----~----~----~------~----~------~--~---
write <tr> in partial files Your main file in my example a.rhtml will look like <%= render :partial=>''b''%> <%= render :partial=>''c'' %> On Thu, Jan 1, 2009 at 6:49 AM, Zhao Yi <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>wrote:> > Ramu wrote: > > Your code will does this job. > > > > Is your problem some thing like: > > you have a.rhtml file > > int that you have to show _b.rhtml file contents as well as _c.rhtml > > contents? > > > > Then write your code like this: > > > > == This is a.rhtml file > > > > <%= render :partial=>''b''%> > > > > <%= render :partial=>''c'' %> > > -- > > Ramu > > But how can I handle the <tr> element? the two partial should be in > different <tr> element. > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ramu --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello. I don''t see anything wrong with this code. Do you want to do something different than this? I guess I am not understanding the problem? On Dec 31 2008, 6:07 am, Zhao Yi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ryan Bigg wrote: > > Render the other partial inside that partial. > > ----- > > Ryan Bigg > > Freelancer > >http://frozenplague.net > > Sorry, I am confused. > > This piece of code is my case: > > <tr> > <td>Version:</td> > <td id="project_version"> > <%= render :partial=>''project_version''%> > </td> > </tr> > > <tr> > <td>View Name:</td> > <td id="view_name"><%= render(:partial=>''view_name'') %></td> > </tr> > > You want me to render "view_name" inside "project_version", how can I do > this in _project_version.html.erb? > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
pepe wrote:> Hello. > > I don''t see anything wrong with this code. Do you want to do something > different than this? I guess I am not understanding the problem? > > On Dec 31 2008, 6:07�am, Zhao Yi <rails-mailing-l...-ARtvInVfO7m5VldFQK4jKA@public.gmane.orgt>I mean in this way, I have to split the <tr> tag. Take this partial for an example: ... </tr> <tr> .... The other part of the <tr> is in the view page. Have you tried this? I got a display problem. -- 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 -~----------~----~----~----~------~----~------~--~---
I am sorry Zhao but I still don''t understand the problem. A concrete example would probably help. However, lets try something here to see if it helps. You should be able to split your page and put into partials whatever parts of the full page you want/need. As long as the final complete page is valid HTML it should work fine. An example: Supposing you need to display something like this: <tr> <td>Text A<td> <td>Text B<td> </tr> <tr> <td>Text C<td> <td>Text D<td> </tr> You could leave in your main page the following: <tr> <td>Text A<td> <%= :render :partial => ''your_partial'' %> <td>Text D<td> </tr> And if your partial delivers: <td>Text B<td> </tr> <tr> <td>Text C<td> Your final product should be what you originally intended. Another sample based on the original listed above. You cold leave in your page: <tr> <%= :render :partial => ''your_A_and_B_partial'' %> </tr> <tr> <%= :render :partial => ''your_C_and_D_partial'' %> </tr> If ''your_A_and_B_partial'' delivers: <td>Text A<td> <td>Text B<td> And ''your_C_and_D_partial'' delivers: <td>Text C<td> <td>Text D<td> You would get the expected results. I hope it helps. If it still does not help send a concrete example of what the final page should look like and what parts of the page you want to make partials and I''ll try to help. Pepe On Jan 2, 3:39 am, Zhao Yi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> pepe wrote: > > Hello. > > > I don''t see anything wrong with this code. Do you want to do something > > different than this? I guess I am not understanding the problem? > > > On Dec 31 2008, 6:07 am, Zhao Yi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > I mean in this way, I have to split the <tr> tag. Take this partial for > an example: > > ... > </tr> > <tr> > .... > > The other part of the <tr> is in the view page. Have you tried this? I > got a display problem. > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
pepe wrote:> Another sample based on the original listed above. You cold leave in > your page: > <tr> > <%= :render :partial => ''your_A_and_B_partial'' %> > </tr> > <tr> > <%= :render :partial => ''your_C_and_D_partial'' %> > </tr> > > If ''your_A_and_B_partial'' delivers: > <td>Text A<td> > <td>Text B<td> > > And ''your_C_and_D_partial'' delivers: > <td>Text C<td> > <td>Text D<td> > > You would get the expected results. > PepeLet''s take a look at your example above. How can I render both ''your_A_and_B_partial'' and ''your_C_and_D_partial''? As you said, I can render ''your_C_and_D_partial'' in the partial ''your_A_and_B_partial''. But how can I do this? thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
are you trying to this??? # your main file <tr> <%= :render :partial => ''A_B_C_D_partial'' %> </tr> # A_B_C_D_partial contains <%= :render :partial => ''A_B_partial'' %> </tr> <tr> <%= :render :partial => ''C_D_partial'' %> # A_B_partial contains and outputs <td>Text A<td> <td>Text B<td> # C_D_partial contains and outputs <td>Text C<td> <td>Text D<td> # ''A_B_C_D_partial'' outputs: <td>Text A<td> <td>Text B<td> </tr> <tr> <td>Text C<td> <td>Text D<td> # your final combined output <tr> <td>Text A<td> <td>Text B<td> </tr> <tr> <td>Text C<td> <td>Text D<td> </tr> On Jan 4, 7:52 am, Zhao Yi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> pepe wrote: > > Another sample based on the original listed above. You cold leave in > > your page: > > <tr> > > <%= :render :partial => ''your_A_and_B_partial'' %> > > </tr> > > <tr> > > <%= :render :partial => ''your_C_and_D_partial'' %> > > </tr> > > > If ''your_A_and_B_partial'' delivers: > > <td>Text A<td> > > <td>Text B<td> > > > And ''your_C_and_D_partial'' delivers: > > <td>Text C<td> > > <td>Text D<td> > > > You would get the expected results. > > Pepe > > Let''s take a look at your example above. How can I render both > ''your_A_and_B_partial'' and ''your_C_and_D_partial''? As you said, I can > render ''your_C_and_D_partial'' in the partial ''your_A_and_B_partial''. But > how can I do this? > > thanks. > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Hi there. If I understand well what you need I think you are trying to make things more complicated than they should be. Forget about your table rows for a moment and lets look at just text. Let''s say that I have to output the following lines: This is my line number 1 This is my line number 2 This is my line number 3 This is my line number 4 This is my line number 5 To make things easy I''ll say that my program has the following code, with no loops: puts ''This is my line number 1'' puts ''This is my line number 2'' puts ''This is my line number 3'' puts ''This is my line number 4'' puts ''This is my line number 5'' Now, if I say that what my program always have to output are lines 1 and 5 and whatever comes in the middle can vary I encapsulate the inner lines in a method call: puts ''This is my line number 1'' print_rest_of_lines puts ''This is my line number 5'' def print_rest_of_lines puts ''This is my line number 2'' puts ''This is my line number 3'' puts ''This is my line number 4'' end The result is what I expect, the 5 lines printed in the sequence I wrote at the beginning. If you treat your partial the same way as you wold treat the method call you will produce the same effect. What I was trying to explain in the previous posting is not that you render ''your_C_and_D_partial from ''your_A_and_B_partial''. What I was trying to say is that you can just divide your table rows in as many (or as little) partials as you need. Just remember that a partial behaves the same as a method call and you''ll understand what you''ll get out of it. Pepe On Jan 4, 7:52 am, Zhao Yi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> pepe wrote: > > Another sample based on the original listed above. You cold leave in > > your page: > > <tr> > > <%= :render :partial => ''your_A_and_B_partial'' %> > > </tr> > > <tr> > > <%= :render :partial => ''your_C_and_D_partial'' %> > > </tr> > > > If ''your_A_and_B_partial'' delivers: > > <td>Text A<td> > > <td>Text B<td> > > > And ''your_C_and_D_partial'' delivers: > > <td>Text C<td> > > <td>Text D<td> > > > You would get the expected results. > > Pepe > > Let''s take a look at your example above. How can I render both > ''your_A_and_B_partial'' and ''your_C_and_D_partial''? As you said, I can > render ''your_C_and_D_partial'' in the partial ''your_A_and_B_partial''. But > how can I do this? > > thanks. > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Hi, Thanks very much for your explaining. You are right. I can make it more simple. thanks again. Zhao Yi -- 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 -~----------~----~----~----~------~----~------~--~---
Glad I could help. Good luck. Pepe On Jan 4, 7:51 pm, Zhao Yi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > Thanks very much for your explaining. You are right. I can make it more > simple. > > thanks again. > > Zhao Yi > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---