# Noob question about the "show" function

**URL:** <https://www.ruby-forum.com/t/noob-question-about-the-show-function/55200>\
**Category:** Rails\
**Created:** [March 17, 2006, 8:58pm UTC](https://www.ruby-forum.com/t/noob-question-about-the-show-function/55200 "2006-03-17T20:58:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jon-d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@jon-d](https://www.ruby-forum.com/u/jon-d)\
**Post date:** [March 17, 2006, 8:58pm UTC](https://www.ruby-forum.com/t/noob-question-about-the-show-function/55200/1 "2006-03-17T20:58:08Z")

</div>

i’ve got a cool app going and it’s getting bigger and bigger, but now  
i’m trying to customize the show function. i’m using the scaffold code  
as a base but can’t seem to get anything to look right. i guess i’m  
confused about how exactly the scaffold code works for the “show”  
function. any help would be awesome! thanks.

jon

---

<div class="post-metadata">

**Author:** ![jon-d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@jon-d](https://www.ruby-forum.com/u/jon-d)\
**Post date:** [March 17, 2006, 9:44pm UTC](https://www.ruby-forum.com/t/noob-question-about-the-show-function/55200/2 "2006-03-17T21:44:46Z")

</div>

Jon Mr wrote:

> i’ve got a cool app going and it’s getting bigger and bigger, but now  
> i’m trying to customize the show function. i’m using the scaffold code  
> as a base but can’t seem to get anything to look right. i guess i’m  
> confused about how exactly the scaffold code works for the “show”  
> function. any help would be awesome! thanks.

What exactly are you trying to achieve?

---

<div class="post-metadata">

**Author:** ![jon-d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@jon-d](https://www.ruby-forum.com/u/jon-d)\
**Post date:** [March 17, 2006, 11:25pm UTC](https://www.ruby-forum.com/t/noob-question-about-the-show-function/55200/3 "2006-03-17T23:25:36Z")

</div>

Alex Y. wrote:

> What exactly are you trying to achieve?

# it show’s too much information… like this…

Monday: 1

Tuesday: 1

Wednesday: 1

Thursday: 1

Friday: 0

Saturday: 1

# Sunday: 0

i only want to display the ones that were checked. but i can’t get it to  
not display all of it. any suggestions?

---

<div class="post-metadata">

**Author:** ![jon-d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@jon-d](https://www.ruby-forum.com/u/jon-d)\
**Post date:** [March 18, 2006, 6:05pm UTC](https://www.ruby-forum.com/t/noob-question-about-the-show-function/55200/4 "2006-03-18T18:05:11Z")

</div>

Jon Mr wrote:

> # Tuesday: 1
> 
> i only want to display the ones that were checked. but i can’t get it to  
> not display all of it. any suggestions?

I presume from this that each weekday is represented as a column in your  
object table. In that case, rather than the current show code which  
looks like this:

\<% for column in ModelName.content\_columns %\>

**\<%= column.human\_name %\>:** \<%=h @model\_name.send(column.name %\>

\<% end %\>

you probably want to do something like:

\<% for column in ModelName.content\_columns  
if @model\_name.send(column.name) == 1 %\>

**\<%= column.human\_name %\>**

\<% end end %\>

---

<div class="post-metadata">

**Author:** ![jon-d](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@jon-d](https://www.ruby-forum.com/u/jon-d)\
**Post date:** [March 17, 2006, 11:34pm UTC](https://www.ruby-forum.com/t/noob-question-about-the-show-function/55200/5 "2006-03-17T23:34:10Z")

</div>

Why don’t you set a :condition in your find() method to only return the  
ones  
where checked = 1?

something like find(:all, :condition =\> “checked = 1”)

I don’t know if the syntax is exactly correct, but would that work?

Ryan
