# Presenting data in 2 styles - 2 action/views or 1?

**URL:** <https://www.ruby-forum.com/t/presenting-data-in-2-styles-2-action-views-or-1/173566>\
**Category:** Rails\
**Created:** [August 11, 2009, 2:46pm UTC](https://www.ruby-forum.com/t/presenting-data-in-2-styles-2-action-views-or-1/173566 "2009-08-11T14:46:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [August 11, 2009, 2:46pm UTC](https://www.ruby-forum.com/t/presenting-data-in-2-styles-2-action-views-or-1/173566/1 "2009-08-11T14:46:54Z")

</div>

Hi I want to present a list of ingredients in an A - Z format and also  
offer a by category format as well in my ingredients index.  
E.g.

A

apple apricot blahblah blahblah  
blah blah blah blah

B  
…

and by category

Fruit  
apple apricot blahblah blahblah  
blah blah blah blah

Vegetables  
…

There are a lot of tutorials that use a table with clickable headers but  
I dont want this format. I trying to think how i can present these  
without creating a lot of code in my index view

will i need to create two seperate action and views for the index?

Im also looking for a non java solution. Any pointers, tips?

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [August 11, 2009, 2:51pm UTC](https://www.ruby-forum.com/t/presenting-data-in-2-styles-2-action-views-or-1/173566/2 "2009-08-11T14:51:59Z")

</div>

sorry i meant “Im looking for a non AJAX solution”

---

<div class="post-metadata">

**Author:** ![scudco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@scudco](https://www.ruby-forum.com/u/scudco)\
**Post date:** [August 11, 2009, 6:15pm UTC](https://www.ruby-forum.com/t/presenting-data-in-2-styles-2-action-views-or-1/173566/3 "2009-08-11T18:15:41Z")

</div>

Adam A. wrote:

> Hi I want to present a list of ingredients in an A - Z format and also  
> offer a by category format as well in my ingredients index.  
> […]  
> will i need to create two seperate action and views for the index?

No. Just pass a URL parameter that specifies the sort order.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
