# True expression still evaluates false

**URL:** <https://www.ruby-forum.com/t/true-expression-still-evaluates-false/114626>\
**Category:** Rails\
**Created:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/true-expression-still-evaluates-false/114626 "2007-09-17T13:23:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chris](https://www.ruby-forum.com/u/chris)\
**Post date:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/true-expression-still-evaluates-false/114626/1 "2007-09-17T13:23:10Z")

</div>

What am I missing about this? I have an expression, which looks to me  
to be true, but it still evaluates to false. Here’s the code:

def self.get\_stars\_from\_id\_array( ids, ruleset\_id )  
templates = Array.new  
ids.each do |i|  
star = find( i )  
logger.info star.ruleset\_id  
logger.info ruleset\_id  
if star.ruleset\_id == ruleset\_id then  
templates.push star  
end  
end  
templates  
end

Logger output is  
1  
1

And yet, star.ruleset\_id = ruleset\_id always evaluates to false. This  
is in my model code. What’s going on here?

Thanks!

Chris

---

<div class="post-metadata">

**Author:** ![chris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chris](https://www.ruby-forum.com/u/chris)\
**Post date:** [September 19, 2007, 7:01am UTC](https://www.ruby-forum.com/t/true-expression-still-evaluates-false/114626/2 "2007-09-19T07:01:36Z")

</div>

Chris wrote:

> ```
> templates.push star
> 
> ```
> 
> is in my model code. What’s going on here?  
> I’m betting that one is a string and one is an integer. Try:

```
 logger.info star.ruleset_id.inspect
 logger.info ruleset_id.inspect

```

Pete Y.

> **[Pete Yandell — Principal Engineer / Architect](https://notahat.com/)**
>
> Pete Yandell is an experienced Principal Software Engineer and Architect based in Melbourne, Australia.
