I am using acts_as_taggable in my application and on the tagging side of things, no problem at all. Running edge Rails and PostgreSQL 8.1. I am then trying to find all my AR objects with a certain tag. The tag is: lasvegas and I know that there are at least 3 records with that tag. So, I''m doing this: @lists = List.find_tagged_with :any => @search_string, :separator => ''+'' The problem is that the SQL generated looks like this: SELECT lists.* FROM lists, tags, taggings WHERE lists.id taggings.taggable_id AND taggings.taggable_type = ''List'' AND taggings.tag_id = tags.id AND tags.name IN (''anylasvegas'', ''separator+'') See what''s right after the IN clause? It says ''anylasvegas'' - why? BTW, using ''lasvegas'' returns the correct results. I used the :any symbol in the finder per the instructions and all the permutations I tried to get rid of it just gave me syntax errors, etc... So, am I doing something wrong or what? Thanks, HH
This patch might help: http://rubyforge.org/tracker/index.php?func=detail&aid=2482&group_id=923&atid=3629 Cheers, -San HH wrote:> I am using acts_as_taggable in my application and on the tagging side of > things, no problem at all. Running edge Rails and PostgreSQL 8.1. > > I am then trying to find all my AR objects with a certain tag. The tag is: > lasvegas and I know that there are at least 3 records with that tag. > > So, I''m doing this: > > @lists = List.find_tagged_with :any => @search_string, :separator => ''+'' > > The problem is that the SQL generated looks like this: > > SELECT lists.* FROM lists, tags, taggings WHERE lists.id > taggings.taggable_id AND taggings.taggable_type = ''List'' AND taggings.tag_id > = tags.id AND tags.name IN (''anylasvegas'', ''separator+'') > > See what''s right after the IN clause? It says ''anylasvegas'' - why? BTW, > using ''lasvegas'' returns the correct results. > > I used the :any symbol in the finder per the instructions and all the > permutations I tried to get rid of it just gave me syntax errors, etc... > > So, am I doing something wrong or what? > > Thanks, > HH
Excellent, I''ll give this a go, thanks. Anyone know the best way to install this patch? I tried simply commenting out the old method in the plugin and inserting this but I get this exception: undefined method `split_tag_names'' for ActiveRecord::Acts::Taggable:Module Indeed, looking at the plug-in I don''t see that method defined anywhere... What gives? Thanks, Hunter> From: San <sanfordsv@yahoo.com> > Reply-To: <rails@lists.rubyonrails.org> > Date: Thu, 09 Feb 2006 15:00:43 -0800 > To: <rails@lists.rubyonrails.org> > Subject: [Rails] Re: acts_as_taggable Produces Bad SQL - Find Fails > > This patch might help: > > http://rubyforge.org/tracker/index.php?func=detail&aid=2482&group_id=923&atid> 3629 > > Cheers, > > -San > > > HH wrote: >> I am using acts_as_taggable in my application and on the tagging side of >> things, no problem at all. Running edge Rails and PostgreSQL 8.1. >> >> I am then trying to find all my AR objects with a certain tag. The tag is: >> lasvegas and I know that there are at least 3 records with that tag. >> >> So, I''m doing this: >> >> @lists = List.find_tagged_with :any => @search_string, :separator => ''+'' >> >> The problem is that the SQL generated looks like this: >> >> SELECT lists.* FROM lists, tags, taggings WHERE lists.id >> taggings.taggable_id AND taggings.taggable_type = ''List'' AND taggings.tag_id >> = tags.id AND tags.name IN (''anylasvegas'', ''separator+'') >> >> See what''s right after the IN clause? It says ''anylasvegas'' - why? BTW, >> using ''lasvegas'' returns the correct results. >> >> I used the :any symbol in the finder per the instructions and all the >> permutations I tried to get rid of it just gave me syntax errors, etc... >> >> So, am I doing something wrong or what? >> >> Thanks, >> HH > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Kenneth Love
2006-Feb-10 21:31 UTC
[Rails] Re: acts_as_taggable Produces Bad SQL - Find Fails
yeah, i''m having problems, too. i get an error with a later function in the gem. any help would be appreciated. On 2/9/06, HH <lists@lastonepicked.com> wrote:> Excellent, I''ll give this a go, thanks. > > Anyone know the best way to install this patch? > > I tried simply commenting out the old method in the plugin and inserting > this but I get this exception: > > undefined method `split_tag_names'' for ActiveRecord::Acts::Taggable:Module > > Indeed, looking at the plug-in I don''t see that method defined anywhere... > > What gives? > > Thanks, > Hunter >