# Find functions not working in Ruby 2.0

**URL:** <https://www.ruby-forum.com/t/find-functions-not-working-in-ruby-2-0/134139>\
**Category:** Ruby\
**Created:** [April 8, 2008, 8:18am UTC](https://www.ruby-forum.com/t/find-functions-not-working-in-ruby-2-0/134139 "2008-04-08T08:18:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mariko](https://www.ruby-forum.com/u/mariko)\
**Post date:** [April 8, 2008, 8:18am UTC](https://www.ruby-forum.com/t/find-functions-not-working-in-ruby-2-0/134139/1 "2008-04-08T08:18:21Z")

</div>

So in my older build, code like this would work fine:  
inbox = user.messages.find(:all, :conditions=\>{:outbox =\> false}, :order  
=\> “date DESC”, :limit =\> limit, :offset =\> offset)

as well as something like this:

@tokens = Item.find(:all, :conditions=\>{:item\_type =\> “token”, :market  
=\> true}).sort\_by {|u| u.refname.downcase}

Now all I’m getting are errors like this:  
Mysql::Error: Unknown column ‘item\_typetokenmarkettrue’ in ‘where  
clause’: SELECT \* FROM items WHERE (item\_typetokenmarkettrue)

I’m not sure to find how to fix this, does anyone know? Thanks for the  
help.

---

<div class="post-metadata">

**Author:** ![mariko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mariko](https://www.ruby-forum.com/u/mariko)\
**Post date:** [April 8, 2008, 8:25am UTC](https://www.ruby-forum.com/t/find-functions-not-working-in-ruby-2-0/134139/2 "2008-04-08T08:25:23Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On Apr 8, 2008, at 8:18 AM, Mariko C. wrote:

> Now all I’m getting are errors like this:  
> Mysql::Error: Unknown column ‘item\_typetokenmarkettrue’ in ‘where  
> clause’: SELECT \* FROM items WHERE (item\_typetokenmarkettrue)
> 
> ## I’m not sure to find how to fix this, does anyone know? Thanks for the help.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Hi, there is no such thing as Ruby 2.0. I think you are talking about  
the  
framework Rails. The Mailing List can be found here:

[http://www.ruby-forum.com/forum/3](http://www.ruby-forum.com/forum/3)

I have the impression that this is indeed a bug, bit the Rails guys will  
be able to help you.

Greetings  
Florian G.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkf7D6sACgkQJA/zY0IIRZZwnQCeJ/n7UAsAwlr5wyp1DyenVI/r  
dd8AnRd9Fw83m1P6SWGCmB+f0YZCmpB8  
=VN+p  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![mariko](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mariko](https://www.ruby-forum.com/u/mariko)\
**Post date:** [April 8, 2008, 8:46am UTC](https://www.ruby-forum.com/t/find-functions-not-working-in-ruby-2-0/134139/3 "2008-04-08T08:46:30Z")

</div>

Why not use the named binding method?

(from the api:)

Company.find(:first, :conditions =\> [ “id = :id AND name = :name AND  
division = :division AND created\_at \> :accounting\_date”, { :id =\>  
3, :name =\> “37signals”, :division =\> “First”, :accounting\_date =\>  
‘2005-01-01’ } ])

> **[ActiveRecord::Base](https://api.rubyonrails.org/classes/ActiveRecord/Base.html)**
>
> Active Record Active Record objects don't specify their attributes directly, but rather infer them from the table definition with which they're linked.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #3 out NOW!  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)
