# How to see stop the #\<Outcome:0x371ace8\> or the #

**URL:** <https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320>\
**Category:** Rails\
**Created:** [September 23, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320 "2008-09-23T17:26:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/1 "2008-09-23T17:26:12Z")

</div>

i am using the following:

\<%= h Outcome.find(:all, :conditions =\> [‘outcomes.outcome\_date =  
(select max(o2.outcome\_date) from outcomes o2 where o2.testrun\_id =  
outcomes.testrun\_id and o2.testcase\_id = outcomes.testcase\_id) and  
outcomes.testrun\_id = ? and outcomes.testcase\_id = ?’, @testrun, tc.id])  
%\>

which is working fine, but as usual in the browser the value appears as:

#Outcome:0x371ace8

or if i remove the h above

# 

is there just one way to get the value, which should just be a 1?

---

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/2 "2008-09-23T17:42:20Z")

</div>

this would depend, on what exactly you want to display.

Outcome.find(:all, …)

will retrieve a set of records and Outcome:0x371ace8 is  
the internal id of that.

do you want the size? then use  
Outcome.find(:all, …).size

or should it return only one record and you want the id column?  
Outcome.find(:first, …).id

would do that (or replace “id” with any column name you want

---

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/3 "2008-09-23T17:51:50Z")

</div>

hi

i want to retrive the value its searching for, which is the result\_id  
column in the outcomes table.

using

Outcome.find(:first, …).result\_id

i get this \>

You have a nil object when you didn’t expect it!  
The error occurred while evaluating nil.result\_id

if i change that to .id

i get 289986 which is a non existent record in the db.

---

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 5:43pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/4 "2008-09-23T17:43:31Z")

</div>

You want \<%= debug your\_code %\>

Greetings  
Johannes  
Am Dienstag, den 23.09.2008, 17:26 +0200 schrieb Brad S.:

---

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 5:57pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/5 "2008-09-23T17:57:01Z")

</div>

with the debug option, the string appears like this:

- !ruby/object:Outcome  
attributes:  
result\_id: “1”  
testrun\_id: “34”  
testcase\_id: “1”  
id: “42”  
outcome\_date: 2008-09-23 15:58:35  
attributes\_cache: {}

result\_id is CORRECT  
testrun\_id is CORRECT  
testcase\_id is CORRECT  
id is CORRECT  
outcome\_date is CORRECT

but essentially its not returning the result\_id???

but how do i get it to return the result\_id?

---

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 5:56pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/6 "2008-09-23T17:56:24Z")

</div>

On Sep 23, 2008, at 11:26 AM, Brad S. wrote:

> as:
> 
> #Outcome:0x371ace8
> 
> or if i remove the h above
> 
> # 
> 
> is there just one way to get the value, which should just be a 1?

Ignoring the presence of so much code in a view, you can define  
Outcome#to\_s to get a customized output for an Outcome object.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/7 "2008-09-23T18:02:16Z")

</div>

> Ignoring the presence of so much code in a view\>\>

yes i totally agree, but i cant quite figure out how to keep it in the  
controller.

because i need to use the tc.id, thats taken from the following loop

\<% @testsuite.testcases.each do |tc| %\>

**\<%= link\_to tc.number, {:controller =\> 'testrun', :action =\> 'runtest', :id =\> tc.id, :id1 =\> @testrun, :id2 =\> @testsuite.id, :id3 =\> @version } -%\>** \<% end %\>

any suggestions would be great, basically its iterating over a list.

test.rhtml  
(tc.id)  
  
TC# DESC STATUS LAST RUN  
1  
2  
3

controller.rb  
@testcase = Testcase.find(:all)  
@testsuite = Testsuite.find(params[:id])

---

<div class="post-metadata">

**Author:** ![bskaggs](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ab097/32.png) [@bskaggs](https://www.ruby-forum.com/u/bskaggs)\
**Post date:** [September 23, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/how-to-see-stop-the-outcome-0x371ace8-or-the/149320/8 "2008-09-23T20:34:43Z")

</div>

On Sep 23, 2008, at 12:02 PM, Brad S. wrote:

> ‘testrun’, :action =\> ‘runtest’, :id =\> tc.id, :id1 =\>  
> @testrun, :id2 =\>  
> @testsuite.id, :id3 =\> @version } -%\>
> 
> \<% end %\>

\<%= render :partial =\> ‘testcase’, :collection =\> @testsuite.testcases  
%\>

in app/views/{controller}/\_testcase.rhtml

**\<%= link\_to testcase.number, {:controller =\> 'testrun', :action =\> 'runtest', :id =\> testcase.id, :id1 =\> @testrun, :id2 =\> testcase.testsuite\_id, :id3 =\> @version } %\>** \<%=h testcase.description %\> \<%=h testcase.status %\> \<%=h testcase.last\_run %\>

If @testrun is an attribute of a testcase or testsuite, it should be  
referenced that way.

> controller.rb  
> @testcase = Testcase.find(:all)  
> @testsuite = Testsuite.find(params[:id])

Shouldn’t @testcase be plural? And if you really mean  
@testsuite.testcases, it doesn’t need to be its own instance variable.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid  
+1 513-295-4739  
Skype: rob.biedenharn
