I have table being filled by a partial. When the fields are filled, the fields end up together or not there for half a page. See below. My controller code and views are below.. controller: @single = Array.new for @h in households do if @h.people.count == 1 @single << @h end end views: christmas.html.erb <table border=1 width="25%"> <th>Single Families</th> <col> <%= render :partial=>"christmas", :collection => @single %> </table> _christmas.html.erb <tr><td><%= h(christmas.name) %></td></tr> The output is: Single Families Amanda Axxrn Paula xxxk Michael BxxxxRxxond Baxxt Carl Lxxxe Bexx Robert BxxxxxrdBetsy xxxxxuJason BrxxxnKeith Bxxxn Frances Brxxxle Edward BxxxkDoris BxxxrThomas CxxxllEdith Cxxxxy Sandra DxxxxxtSuzanne DxxxxxultJoyce Dxxxk Frances Dxxxxn Barbara DxxxdyRita DxxxxinVirginia Dxxxis Donald Exxxy Lorraine ExxxxElsie FxxxufEvelyn Fxxxnd Patricia Fxxxxy Romeo Fxxx Cheryl FxxerAlice Frxxxe Rita Gxxs -- 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 26 August 2010 07:38, Bob Smith <bsm2th-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have table being filled by a partial. When the fields are filled, > the fields end up together or not there for half a page. See below. My > controller code and views are below.. > > controller: > @single = Array.new > for @h in households do > if @h.people.count == 1 > @single << @h > end > end > > views: > christmas.html.erb > <table border=1 width="25%"> > <th>Single Families</th> > <col> > <%= render :partial=>"christmas", :collection => @single %> > </table> > > _christmas.html.erb > <tr><td><%= h(christmas.name) %></td></tr> > > The output is: > > Single Families > Amanda Axxrn > Paula xxxk > Michael BxxxxRxxond Baxxt > Carl Lxxxe Bexx > Robert BxxxxxrdBetsy xxxxxuJason BrxxxnKeith Bxxxn > Frances Brxxxle > [...]Firstly have a look at the generated html (View, Page Source or similar in the browser) and see if it is what you expect. If it looks ok then copy and paste it into the w3c html validator (google for it) to check it is valid. See if that shows anything. I am not sure what the <COL> tag is for 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bob Smith wrote:> views: > christmas.html.erb > <table border=1 width="25%"> > <th>Single Families</th> > <col> > <%= render :partial=>"christmas", :collection => @single %> > </table> >Perhaps something like: <table border=1 width="25%"> <tr> <th>Single Families</th> </tr> <%= render :partial => "christmas", :collection => @single %> </table> -- 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 Aug 26, 9:21 am, Ar Chron <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Bob Smith wrote: > > views: > > christmas.html.erb > > <table border=1 width="25%"> > > <th>Single Families</th> > > <col> > > <%= render :partial=>"christmas", :collection => @single %> > > </table> > > Perhaps something like: > > <table border=1 width="25%"> > <tr> > <th>Single Families</th> > </tr> > <%= render :partial => "christmas", :collection => @single %> > </table> > -- > Posted viahttp://www.ruby-forum.com/.No change. It uses the top half of the page to print, then skips the bottom half. Still doesn''t use the cell size either. Another table in the same controller action and same view works fine. While I was messing with this, the only thing that made the cells line up with no skips was to put the name field three times so it used the entire width of the page. Hope this helps. Bob Bob -- 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 wonder if internally (in Rails) something is getting confused between your view name (christmas.html.erb) and the partial name (_christmas.html.erb). What if you rename your partial to something like _christmas_row.html.erb? And if there is another table in the same view, it might be that your generated html is not closing properly before attempting to generate the christmas table... Feel free to post the view in its entirety, because the solution *should* be relatively simple. -- 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.