# Inconsistency of data in controller and irb

**URL:** <https://www.ruby-forum.com/t/inconsistency-of-data-in-controller-and-irb/83066>\
**Category:** Rails\
**Created:** [January 23, 2007, 2:07pm UTC](https://www.ruby-forum.com/t/inconsistency-of-data-in-controller-and-irb/83066 "2007-01-23T14:07:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![abon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@abon](https://www.ruby-forum.com/u/abon)\
**Post date:** [January 23, 2007, 2:07pm UTC](https://www.ruby-forum.com/t/inconsistency-of-data-in-controller-and-irb/83066/1 "2007-01-23T14:07:07Z")

</div>

I have a find query in a controller like this

def loadtags(product)  
@tags =  
Tagging.find\_all\_by\_taggable\_type\_and\_taggable\_id(0,product.id)  
puts product.id  
puts @tags.collect{|x| x.id}  
@tags.collect!{|x| x.id}.collect!{|x| Tag.find(x)}  
puts @tags.collect{|x| x.name}  
puts ‘----------------------------’  
@tags  
end

and I test with the same parameters in irb

but get different search results.

The one in controller returns some taggings I already deleted in the  
database while it returns the right data while in irb.  
I thought there may be some caching undergoing.  
So I restarted the app.  
But the situation remains.

Any one can solve the mystery here?  
Many thanks,
