Forum: Ruby on Rails Does acts_as_taggable work with Oracle?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Duane (Guest)
on 2007-06-05 05:58
I'm using acts_as_taggable just fine with my Oracle database using the
oci driver, until I try to either use the tags_count, or tagged_related.

For tags_count I can get the default hash table fine, but if I try to
provide a filter like "count > 3", I get an error:

Content.tags_count(:count=>'>3')

ActiveRecord::StatementInvalid: OCIError: ORA-00904: "COUNT": invalid
identifier
: SELECT tags.id AS id, tags.name AS name, COUNT(*) AS count FROM
contents_tags,
 content_table, tags WHERE contents_tags.tag_id = tags.id
                AND contents_tags.content_id = content_table.content_id
GROUP BY
  tags.id,tags.name HAVING count >3  ORDER BY count DESC
        from
C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_re
cord/connection_adapters/abstract_adapter.rb:120:in `log'
        from
C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_re
cord/connection_adapters/oracle_adapter.rb:271:in `execute'
        from
C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_re
cord/connection_adapters/oracle_adapter.rb:473:in `select'
        from
C:/newruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_re
cord/connection_adapters/oracle_adapter.rb:262:in `select_all'
        from
C:/newruby/lib/ruby/gems/1.8/gems/acts_as_taggable-2.0.2/lib/taggab
le.rb:339:in `tags_count'
        from (irb):24

This should be allowed, from the docs:

+:count+: Adds a HAVING clause to the SQL statement, where you can set
conditions for the 'count' column. For example: '> 50'

But Oracle doesn't like the final result.  Is there some special tweak
I'm supposed to make to the HAVING clause work properly?

D
(Guest)
on 2007-06-20 21:28
(Received via mailing list)
This topic is locked and can not be replied to.