# Scaffolding Results Format

**URL:** <https://www.ruby-forum.com/t/scaffolding-results-format/168927>\
**Category:** Rails\
**Created:** [May 27, 2009, 1:16pm UTC](https://www.ruby-forum.com/t/scaffolding-results-format/168927 "2009-05-27T13:16:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jayco](https://www.ruby-forum.com/u/jayco)\
**Post date:** [May 27, 2009, 1:16pm UTC](https://www.ruby-forum.com/t/scaffolding-results-format/168927/1 "2009-05-27T13:16:47Z")

</div>

Hi Everyone,

I built a scaffold and I’m having trouble getting results properly  
formatted. (I need to get the data into multiple columns instead of just  
one big column) I can’t get all of my CSS to work properly in  
scaffold.css, layout/books.rhtml, or the books/index.rhtml.erb Anyways,  
maybe you have a suggestion.

Default view (127.0.0.1:3000/books)

Title Abstract  
Book One Book One Abstract Show Edit Destroy  
Book Two Book Two Abstract Show Edit Destroy  
Book Three Book Three Abstract Show Edit Destroy

* * *

View I would like to see displayed (127.0.0.1:3000/books):

Book One Book Two Book Three  
Book One Abstract Book Two Abstract Book Three  
Abstract  
Show Edit Destroy Show Edit Destroy Show Edit Destroy

* * *

I’ve tried editing scaffold.css, layouts/books.rhtml.erb, and  
books/index.rhtml.erb but can only achieve this result:

Book One  
Book One Abstract  
Show Edit Destroy  
Book Two  
Book Two Abstract  
Show Edit Destroy  
Book Three  
Booth Three Abstract  
Show Edit Destroy

* * *

Am I missing something in books\_controller.rb? Thanks for your help!

---

<div class="post-metadata">

**Author:** ![jayco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jayco](https://www.ruby-forum.com/u/jayco)\
**Post date:** [May 27, 2009, 1:29pm UTC](https://www.ruby-forum.com/t/scaffolding-results-format/168927/2 "2009-05-27T13:29:47Z")

</div>

On Wed, May 27, 2009 at 4:16 AM, Jay C. \<  
removed\_email\_address@domain.invalid\> wrote:

> Default view (127.0.0.1:3000/books)
> 
> Book One Book Two Book Three  
> Book One Abstract Book Two Abstract Book Three  
> Abstract  
> Show Edit Destroy Show Edit Destroy Show Edit Destroy

The presentation of the output you would like to have is very confusing  
at best. For example, what does edit and destroy links do at the bottom  
of each table? Do they operate on all of the entries? You might want  
to  
clarify what you’re really trying to do with this type of structure.

-Conrad

[snip]

---

<div class="post-metadata">

**Author:** ![jayco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jayco](https://www.ruby-forum.com/u/jayco)\
**Post date:** [May 27, 2009, 1:46pm UTC](https://www.ruby-forum.com/t/scaffolding-results-format/168927/3 "2009-05-27T13:46:24Z")

</div>

Conrad T. wrote:

> On Wed, May 27, 2009 at 4:16 AM, Jay C. \<  
> removed\_email\_address@domain.invalid\> wrote:
> 
> > Default view (127.0.0.1:3000/books)
> > 
> > Book One Book Two Book Three  
> > Book One Abstract Book Two Abstract Book Three  
> > Abstract  
> > Show Edit Destroy Show Edit Destroy Show Edit Destroy
> 
> The presentation of the output you would like to have is very confusing  
> at best. For example, what does edit and destroy links do at the bottom  
> of each table? Do they operate on all of the entries? You might want  
> to  
> clarify what you’re really trying to do with this type of structure.
> 
> -Conrad
> 
> [snip]

* * *

By default, scaffold displays data into rows it seems. Disregard the  
“Show” “Edit” “Destroy” links as they are just the generic actions  
produced by creating the scaffold. All I’m trying to do is get the  
127.0.0.1:books to display the data in multiple columns instead of just  
one.

Book One Book Two Book Three  
Book One Abstract Book Two Abstract Book Three Abstract

Book Four Book Five Book Six  
Book Four Abstract Book Five Abstract Book Six Abstract

---

<div class="post-metadata">

**Author:** ![jayco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jayco](https://www.ruby-forum.com/u/jayco)\
**Post date:** [May 28, 2009, 2:35pm UTC](https://www.ruby-forum.com/t/scaffolding-results-format/168927/4 "2009-05-28T14:35:44Z")

</div>

Ar Chron wrote:

> Take a look at the in\_groups\_of method for your list processing in the  
> view…
> 
> @books.in\_groups\_of(3) do |group|  
> start row  
> group.each.do |book|  
> start column  
> book.title + ‘’ + book.abstract  
> end column  
> end  
> end row  
> end
> 
> or something like that…

Thanks Ar Chron! That is the right method. Railscast #28 discusses this  
in\_groups\_of method for anyone encountering the same problem.

---

<div class="post-metadata">

**Author:** ![jayco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jayco](https://www.ruby-forum.com/u/jayco)\
**Post date:** [May 27, 2009, 11:20pm UTC](https://www.ruby-forum.com/t/scaffolding-results-format/168927/5 "2009-05-27T23:20:18Z")

</div>

Take a look at the in\_groups\_of method for your list processing in the  
view…

@books.in\_groups\_of(3) do |group|  
start row  
group.each.do |book|  
start column  
book.title + ‘’ + book.abstract  
end column  
end  
end row  
end

or something like that…
