Hello, How does the "render :partial => ''/comment/form'', :collection=>@blog.comments" work? What object does this pass to the partial view? How do I access the comment object in partial view? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 25 November 2010 11:59, Vineeth Pradhan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hello, > > How does the "render :partial => ''/comment/form'', > :collection=>@blog.comments" work? What object does this pass to the > partial view? How do I access the comment object in partial view?Have a look at the Rails Guide on Layouts and Rendering. It should get you started at least. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yes, you would better read about that. But I will answer, in partial you would be able to access to the item by accessing variable named by the name of the partial, in your case "form" On Thu, Nov 25, 2010 at 2:03 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 25 November 2010 11:59, Vineeth Pradhan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Hello, > > > > How does the "render :partial => ''/comment/form'', > > :collection=>@blog.comments" work? What object does this pass to the > > partial view? How do I access the comment object in partial view? > > Have a look at the Rails Guide on Layouts and Rendering. It should > get you started at least. > > Colin > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- С уважением, Виталий Янчук http://www.vitalik.com.ua/ -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
"Виталий Янчук" <mail-WqhgwETvZgLzHCZZHnFgRw@public.gmane.org> wrote in post #963883:> Yes, you would better read about that. > But I will answer, in partial you would be able to access to the item by > accessing variable named by the name of the partial, in your case "form" > > On Thu, Nov 25, 2010 at 2:03 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > wrote: > >> Colin >> >> > > > -- > С уважением, > > Виталий Янчук > http://www.vitalik.com.ua/Thanks you! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
hey Vineeth, As mentioned by others about understand the concept of partial first thats true. But the collection object can be accessable by the name of partial in you case you can access using "<%= form.attribute_name %>" <%= "render :partial => ''/comment/form'', :collection=>@blog.comments" %> But if in-case you don''t want the object name "form" then you can parse "as => object_name" while calling partial. there are few more options like "form_counter" etc if you want to display it. Thanks Abhis On Fri, Nov 26, 2010 at 11:38 AM, Vineeth Pradhan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> "Виталий Янчук" <mail-WqhgwETvZgLzHCZZHnFgRw@public.gmane.org> wrote in post #963883: > > Yes, you would better read about that. > > But I will answer, in partial you would be able to access to the item by > > accessing variable named by the name of the partial, in your case "form" > > > > On Thu, Nov 25, 2010 at 2:03 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> > > wrote: > > > >> Colin > >> > >> > > > > > > -- > > С уважением, > > > > Виталий Янчук > > http://www.vitalik.com.ua/ > > > > Thanks you! > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Abhishek shukla wrote in post #964036:> hey Vineeth, > > As mentioned by others about understand the concept of partial first > thats > true. > > But the collection object can be accessable by the name of partial in > you > case you can access using "<%= form.attribute_name %>" > <%= "render :partial => ''/comment/form'', :collection=>@blog.comments" %> > > But if in-case you don''t want the object name "form" then you can parse > "as > => object_name" while calling partial. there are few more options like > "form_counter" etc if you want to display it. > > Thanks > AbhisThanks, that''s quite a lot of useful information. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.