Hi Folks, The acts_as_taggable mixin is now available as a shiny gem. More details here: http://dema.ruby.com.br/articles/2005/09/13/acts-as-taggable-gemified This release features some cool additions as well. Cheers Dema -- http://dema.ruby.com.br - Rails from a .NET perspective
Hello, Thank you for this great work. I have just tried the acts_as_taggable lib with the just released gem but I encounter a problem with Postrgesql. The generated SQL code when using find_tagged_with :all is similar to this: SELECT bookmarks.* FROM tags_bookmarks, bookmarks, tags WHERE tags_bookmarks.tag_id = tags.id AND (tags.name = ''Java'' OR tags.name=''DataBase'') AND bookmarks.id = tags_bookmarks.bookmark_id GROUP BY bookmarks.id HAVING COUNT(bookmarks.id) = 2 This code is rejected under Postgres with the cause being that GROUP BY forces the SELECT part to only reference columns that appear in the GROUP BY clause or columns with an aggregate function applied. Here, we try to select all columns but only the bookmark.id column appears in the GROUP BY. This code would also be invalid under Oracle. A valid version in Postgres/Oracle would be something like this: SELECT bookmarks.* FROM bookmarks WHERE bookmarks.id IN (SELECT DISTINCT tags_bookmarks.bookmark_id FROM tags_bookmarks, tags WHERE tags_bookmarks.tag_id = tags.id AND (tags.name = ''Rails'' OR tags.name=''DataBase'')) I hope this helps. Julien
Sam Joseph
2006-Feb-08 14:01 UTC
[Rails] acts_as_taggable tests appear to rely on special database setup
Hi, I''ve posted this to rubyforge, but I thought I''d post here as well in case anyone outside the acts_as_taggable project has experienced this. I''m trying to run the acts_as_taggable unit tests. I found I had to create various tables, and even once I had created them all I still got some errors. Errors and required tables below and at: http://rubyforge.org/tracker/index.php?func=detail&aid=3497&group_id=923&atid=3629 I was wondering if I might be able to get some input on how to run these tests properly. It would be nice if the tests could run completely standalone. I''m hoping to submit a patch that allows the "name" column on the tag table to be adjusted. CHEERS> SAM 1) Failure: test_find_related_tags(ActAsTaggableTest) [test/acts_as_taggable_test.rb:216]: <2> expected but was <1>. 2) Error: test_find_tagged_with_on_subclasses(ActAsTaggableTest): NoMethodError: undefined method `tag'' for nil:NilClass test/acts_as_taggable_test.rb:223:in `test_find_tagged_with_on_subclasses'' 3) Failure: test_tag_cloud(ActAsTaggableTest) [test/acts_as_taggable_test.rb:318]: <9> expected but was <11>. 4) Error: test_tagging_with_join_model(ActAsTaggableTest): NoMethodError: undefined method `tag'' for nil:NilClass test/acts_as_taggable_test.rb:106:in `test_tagging_with_join_model'' 5) Error: test_with_non_defaults(ActAsTaggableTest): NoMethodError: undefined method `tag_names'' for nil:NilClass test/acts_as_taggable_test.rb:342:in `test_tagging'' test/acts_as_taggable_test.rb:91:in `test_with_non_defaults'' Additional tables required by tests: DROP TABLE IF EXISTS `companies`; CREATE TABLE IF NOT EXISTS `companies` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '''', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; DROP TABLE IF EXISTS `posts`; CREATE TABLE IF NOT EXISTS `posts` ( `id` int(11) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '''', `respond_to` varchar(255) NOT NULL default '''', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; DROP TABLE IF EXISTS `topics`; CREATE TABLE IF NOT EXISTS `topics` ( `id` int(11) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '''', `approved` tinyint(4) default NULL, `replies_count` int(11) default NULL, `content` varchar(255) default NULL, `written_on` datetime default NULL, `parent_id` int(11) default NULL, `author_name` varchar(255) default NULL, `bonus_time` datetime default NULL, `author_email_address` varchar(255) default NULL, `last_read` date default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
John Nunemaker
2006-Feb-08 15:47 UTC
[Rails] Re: acts_as_taggable tests appear to rely on special database setup
Sam, The acts_as_taggable( ) plugin relies on the poly-morphic associations feature of ActiveRecord, which was added after Rails 1.0. You will need to do a ''rake freeze_edge'' in the application you want to use the taggable plugin with. This will download edge rails into your vendor folder. Your application will then use the rails version in your vendor folder automatically rather than the version installed on the server you are using.
Sam Joseph
2006-Feb-08 16:26 UTC
[Rails] Re: acts_as_taggable tests appear to rely on special database setup
Hi John, I''m interested to hear that, because my acts_as_taggable gem appears to work fine with my 0.14.3 rails. I don''t know that I am using a plugin as such. Acts_as_taggable works just fine. I checked out the acts_as_taggable source from rubyforge and got a set of tests that rely on some particular tables being present. The basic tables are created by the acts_as_taggable_test.rb, but there are 3 (companies, posts and topics) not created by the tests, meaning that the acts_as_taggable tests will not run standalone. I don''t think that switching to edge rails will magically make those tables appear when I run the acts_as_taggable tests. Many thanks. CHEERS> SAM John Nunemaker wrote:>Sam, > >The acts_as_taggable( ) plugin relies >on the poly-morphic associations feature >of ActiveRecord, which was added >after Rails 1.0. You will need to do a >''rake freeze_edge'' in the application you >want to use the taggable plugin with. >This will download edge rails into your >vendor folder. Your application will >then use the rails version in your vendor >folder automatically rather than the >version installed on the server you are >using. > > > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > > >
Roberto Saccon
2006-Feb-08 16:38 UTC
[Rails] Re: acts_as_taggable tests appear to rely on special database setup
there are two act_as_taggable plugins: one is a gem from rubyforge and the other is a plugin by DHH form rails source repository On 2/8/06, Sam Joseph <sam@neurogrid.com> wrote:> > Hi John, > > I''m interested to hear that, because my acts_as_taggable gem appears to > work fine with my 0.14.3 rails. > > I don''t know that I am using a plugin as such. Acts_as_taggable works > just fine. > > I checked out the acts_as_taggable source from rubyforge and got a set > of tests that rely on some particular tables being present. The basic > tables are created by the acts_as_taggable_test.rb, but there are 3 > (companies, posts and topics) not created by the tests, meaning that the > acts_as_taggable tests will not run standalone. > > I don''t think that switching to edge rails will magically make those > tables appear when I run the acts_as_taggable tests. > > Many thanks. > > CHEERS> SAM > > John Nunemaker wrote: > > >Sam, > > > >The acts_as_taggable( ) plugin relies > >on the poly-morphic associations feature > >of ActiveRecord, which was added > >after Rails 1.0. You will need to do a > >''rake freeze_edge'' in the application you > >want to use the taggable plugin with. > >This will download edge rails into your > >vendor folder. Your application will > >then use the rails version in your vendor > >folder automatically rather than the > >version installed on the server you are > >using. > > > > > > > >_______________________________________________ > >Rails mailing list > >Rails@lists.rubyonrails.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Roberto Saccon - http://rsaccon.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060208/c97790e2/attachment-0001.html