Ronald Sacher
2006-Jun-23 15:58 UTC
[Rails] ActiveRacord::Base find does not support HAVING ?!
Hi,
I''m new to Ruby/Rails and trying to do something like:
options = {
:select=>''t1.*, count(c2)'',
:joins=> ''AS t1 LEFT JOIN t2 ON t1.ID=t2.t1_id'',
:group=> ''t1.id'',
:having=> "count(c2) = #{my_var}"
}
T1.find(:all,options)
But I got the following error:
ArgumentError in T1Controller#action1
Unknown key(s): having
lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/core_ext/hash/keys.rb:48:in
`assert_valid_keys''
lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1325:in
`validate_find_options''
lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:376:in
`find''
Why is this unsupported?
Thanks in advance
Ronald
--
Posted via http://www.ruby-forum.com/.
