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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
justin.kestelyn-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
2007-Jun-20 17:27 UTC
Re: Does acts_as_taggable work with Oracle?
This may interest you: http://www.oracle.com/technology/pub/articles/kern-rails-tagging.html On Jun 4, 6:58 pm, Duane <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''m using acts_as_taggable just fine with myOracledatabase 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'' > > ButOracledoesn''t like the final result. Is there some special tweak > I''m supposed to make to the HAVING clause work properly? > > D > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---