Hello, I''m facing very simple weird error. in my main page main.html.erb <%=render(@locations) %> and in I try to output name twice locations/location.html.erb <li><%=location.name%> <%=location.name%><%=location.name%><%=location.name%></li> name attribute only outputs one time?? I cannot figure out why this is happening? //Jamal -- 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 11 June 2012 14:58, Jamal Soueidan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hello, > > I''m facing very simple weird error. > > in my main page main.html.erb > > <%=render(@locations) %> > > and in I try to output name twice > > locations/location.html.erb > > <li><%=location.name%> > <%=location.name%><%=location.name%><%=location.name%></li> > > name attribute only outputs one time??To work out what is going on in these situations it is often worth while to fiddle with what you have and see what happens. For example what if you try <li>A <%=location.name%> B <%=location.name%> C <%=location.name%> D <%=location.name%> E</li> Also look at the generated html (View > Page Source or similar in the browser) to see what is there. 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.
Colin, I already tried that It''s only outputting A and nothing else. but if I change to. <% @locations.each do |location| %> <li>A <%=location.name%> B <%=location.name%> C <%=location.name%> D <%=location.name%> E</li> <% end %> it works. -- 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 11 June 2012 15:16, Jamal Soueidan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin, I already tried that > > It''s only outputting A and nothing else. > > but if I change to. > > <% @locations.each do |location| %> > <li>A <%=location.name%> B > <%=location.name%> C <%=location.name%> D <%=location.name%> E</li> > <% end %> > > it works.Could you please quote the previous message so that it easier to follow the thread. Remember this is a mailing list not a forum (though you may be accessing it through a forum interface). If you did not have the each loop round it then what was setting up location? 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote in post #1064044:> On 11 June 2012 15:16, Jamal Soueidan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> it works. > > Could you please quote the previous message so that it easier to > follow the thread. Remember this is a mailing list not a forum > (though you may be accessing it through a forum interface). > > If you did not have the each loop round it then what was setting up > location? > > ColinHello, I''m facing very weird issue. in my main page main.html.erb <%=render(@locations) %> ....and in locations/location.html.erb ....I try to output name twice <li><%=location.name%> <%=location.name%><%=location.name%><%=location.name%></li> name attribute only outputs one time?? it ignore the rest of <%location.name %> I cannot figure out why this is happening? //Jamal -- 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.
Colin Law wrote in post #1064039:> On 11 June 2012 14:58, Jamal Soueidan <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> locations/location.html.erb >> >> <li><%=location.name%> >> <%=location.name%><%=location.name%><%=location.name%></li> >> >> name attribute only outputs one time?? > > To work out what is going on in these situations it is often worth > while to fiddle with what you have and see what happens. For example > what if you try > <li>A <%=location.name%> B > <%=location.name%> C <%=location.name%> D <%=location.name%> E</li> > > Also look at the generated html (View > Page Source or similar in the > browser) to see what is there. > > ColinColin, I already tried that It''s only outputting A and nothing else. but if I change to. <% @locations.each do |location| %> <li>A <%=location.name%> B <%=location.name%> C <%=location.name%> D <%=location.name%> E</li> <% end %> it works. -- 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.
Try to be more specific with old versions of Rails and change <%= render(@locations) %> to <%= render :partial => "location/location", :collection => @locations %> In this case _location partial should have local variable "location" correctly set. Hope, this helps. MaxR> > Colin, I already tried that > > It''s only outputting A and nothing else. > > but if I change to. > > <% @locations.each do |location| %> > <li>A <%=location.name%> B > <%=location.name%> C <%=location.name%> D <%=location.name%> E</li> > <% end %> > > it works. > > -- > 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-/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.
I fixed the issue, it was related to override of name attribute in the model class. -- 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.