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! -- Posted via http://www.ruby-forum.com/.
On Wed, May 27, 2009 at 4:16 AM, Jay Covington < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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 DestroyThe 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]> > -- > 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 -~----------~----~----~----~------~----~------~--~---
Conrad Taylor wrote:> On Wed, May 27, 2009 at 4:16 AM, Jay Covington < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> 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 -- Posted via http://www.ruby-forum.com/.
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 + ''</br>'' + book.abstract end column end end row end or something like that... -- Posted via http://www.ruby-forum.com/.
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 + ''</br>'' + 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. -- Posted via http://www.ruby-forum.com/.