[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Find functions not working in Ruby 2.0

Mariko C.

4/8/2008 6:19:00 AM

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.
--
Posted via http://www.ruby-....

2 Answers

Florian Gilcher

4/8/2008 6:25:00 AM

0

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


On Apr 8, 2008, at 8:18 AM, Mariko C. wrote:
> 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.
> --
> Posted via http://www.ruby-....
>

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/3

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

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

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

Julian Leviston

4/8/2008 6:46:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

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' } ])

http://api.rubyonrails.org/classes/ActiveRecord...


Julian.



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


On 08/04/2008, at 4:18 PM, Mariko C. wrote:

> 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.
> --
> Posted via http://www.ruby-....
>