Hi there, I have a partial like this: <%= render :partial => @person.address %> and in app/views/addresses/_address.html.erb: Street: <%= address.street %> But address in the partial is nil... shouldn''t the local variable ''address'' be available in the partial? And why is it nil? 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 -~----------~----~----~----~------~----~------~--~---
Sorry the wrong title, it seems that Safari on windows cut some text on text fields. The title should be: "Partial not passing local variables" -- 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 -~----------~----~----~----~------~----~------~--~---
On 27 Mar 2008, at 13:04, Henrique Testa wrote:> > Hi there, > > I have a partial like this: > > <%= render :partial => @person.address %> > > and in app/views/addresses/_address.html.erb: > > Street: <%= address.street %> > > But address in the partial is nil... shouldn''t the local variable > ''address'' be available in the partial? And why is it nil? >Did you mean to write render :partial => ''address'', :object => @person.address ? Fred> 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 27 Mar 2008, at 13:04, Henrique Testa wrote: > >> >> But address in the partial is nil... shouldn''t the local variable >> ''address'' be available in the partial? And why is it nil? >> > Did you mean to write render :partial => ''address'', :object => > @person.address ? > > FredDoesn''t Rails Edge have this syntax? Now I am confusing... I saw this on a ticket but now I can''t find it. The right partial is rendered, although the local variable ''address'' is nil. Anyway, using :object works fine, 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 -~----------~----~----~----~------~----~------~--~---