search for: taggable_id

Displaying 17 results from an estimated 17 matches for "taggable_id".

2006 May 07
6
Challenging SQL for you...
...items that are tagged with *all* these tags. The plugin uses primarily two tables: tags, to keep all the various tag names and ids, and taggings, which actually associates the tags table with other items in your database. So, tags looks like: [id][name] and taggings looks like: [id][tag_id][taggable_id][taggable_type] id and tag_id above serve to join the two tables...taggable_id is the id of a tuple in another relation in the database, and type is the name of said relation. What I want to do is select * taggable_id''s from taggings that have tag_ids matching a set of ids from the...
2006 Apr 21
3
polymorphic,has_many through can not work?
...4/03/polymorphic-through I do that according to Josh Susser''s procedure: class Tagging < ActiveRecord::Base belongs_to :tag belongs_to :taggable, :polymorphic => true belongs_to :article, :class_name => "Article", :foreign_key => "taggable_id", :conditions => "taggable_type = ''Article''" belongs_to :user, :class_name => "User", :foreign_key => "taggable_id", :conditions => "taggable_type = ...
2006 Jun 30
0
find_by_sql not quoting properly (in acts_as_taggable plugin)
...e length, but I wanted to be complete. ;-) The method from acts_as_taggable.rb is: def find_tagged_with(list) find_by_sql(["SELECT #{table_name}.* FROM #{table_name}, tags, taggings " + "WHERE #{table_name}.#{primary_key} = taggings.taggable_id " + "AND taggings.taggable_type = ''# {acts_as_taggable_options[:taggable_type]}'' " + "AND taggings.tag_id = tags.id AND tags.name IN (?)", list] ) end Originally, this built a string d...
2006 Feb 16
1
[PATCH] acts_as_taggable plugin
...def find_tagged_with(list) find_by_sql( - "SELECT #{table_name}.* FROM #{table_name}, tags, taggings " + + "SELECT DISTINCT #{table_name}.* FROM #{table_name}, tags, taggings " + "WHERE #{table_name}.#{primary_key} = taggings.taggable_id " + "AND taggings.taggable_type = ''#{acts_as_taggable_options[:taggable_type]}'' " + "AND taggings.tag_id = tags.id AND tags.name IN (#{list.collect { |name| "''#{name}''" }.join(", ")})"...
2006 Feb 09
3
acts_as_taggable Produces Bad SQL - Find Fails
...at 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'...
2006 Apr 04
5
How to implement tag clouds using plugin?
...yonrails.org/rails/pages/ActsAsTaggablePluginHowto gives an corresponding implementation for acts_as_taggable plugin : def tags_count(options) sql = "SELECT tags.id AS id, tags.name AS name, COUNT(*) AS count FROM tags, taggings, #{table_name} " sql << "WHERE taggings.taggable_id = #{table_name}.#{primary_key} AND taggings.tag_id = tags.id " sql << "AND #{sanitize_sql(options[:conditions])} " if options[:conditions] sql << "GROUP BY tags.name " sql << "HAVING count #{options[:count]} " if options[:count] sql...
2008 Jun 13
1
Polymorphic :through associations
Could someone please help me with this association scheme? I am familiar with habtm as well as the :through association but this one has me stumped. Here is an example DB. Tags Table: ------------------------- id name Taggables Table: -------------------------- id tag_id taggble_type taggable_id For purposes of this example say that there are 2 other tables that can be tagged and their model name would appear in the taggable_type field along with their id in the taggable id. I have seen this done somewhat with the: belongs_to :taggable, :polymorphic => true but never with a join tab...
2006 May 06
3
Extending Rails plugins?
...hack away? FYR, I want to add a method to the following module: == module SingletonMethods def find_tagged_with(list) find_by_sql([ "SELECT #{table_name}.* FROM #{table_name}, tags, taggings " + "WHERE #{table_name}.#{primary_key} = taggings.taggable_id " + "AND taggings.taggable_type = ? " + "AND taggings.tag_id = tags.id AND tags.name IN (?)", acts_as_taggable_options[:taggable_type], list ]) end end == Thanks! B.A. -- B.A. Baracus: I thought you weren'...
2006 Aug 10
2
search acts_as_taggable for multiple tags
Hey...I''m trying to search a Model that uses acts_as_taggable for multiple tags. I''d like to pass in a search string containing a space delimited tags names (i.e. "tag1 tag2") and return the objects that have been tagged by either one of those. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Feb 09
0
acts_as_taggable Generating Funky SQL
...at 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'...
2006 Nov 11
0
acts_as_taggable plugin - paging through tagged model
...vendor/plugins/acts_as_taggable/lib/acts_as_taggable.rb replace old find_tagged_with - with the below.. def find_tagged_with(list, options = {}) query = "SELECT #{table_name}.* FROM #{table_name}, tags, taggings " query << "WHERE #{table_name}.#{primary_key} = taggings.taggable_id " query << "AND taggings.taggable_type = ? " query << "AND taggings.tag_id = tags.id AND tags.name IN (?) " query << "limit #{options[:limit]} " if options[:limit] != nil query << "offset #{options[:offset]} " if op...
2011 Sep 17
0
joining and array with a table in ActiveRecord
Hey I am pretty new to Ruby on Rails and I have no idea how to solve the following: I have a join query on a table like this: def mytags Taggable.joins("JOIN taggables as filter ON taggables.tag_id = filter.tag_id WHERE filter.taggable_type = ''User'' AND filter.taggable_id = 1").all end this works perfectly fine. then I want to join the result on another table, where OtherTable.joins(@mytags) works also fine BUT I want to join on two other colums and NOT on the ids.... Can anyone tell me how to do this? thx -- Posted via http://www.ruby-forum.com/. -- Yo...
2009 Sep 09
4
Tagging recommendation - acts_as_taggable_on_steroids best?
hey all What''s the most popular tagging plugin/gem these days? Is it acts_as_taggable_on_steroids? Or is something else better? I''d like to basically replicate flickr''s tagging as much as possible, eg allowing multi-word tags to be denoted by quotes or seperated by commas. thanks max -- Posted via http://www.ruby-forum.com/.
2006 Nov 04
2
strange errors in dev.log and webserver log
...(0.003020) SELECT * FROM cards WHERE (cards.id = ''5'') LIMIT 1 Rendering within layouts/admin Rendering cards/edit Card Columns (0.004928) SHOW FIELDS FROM cards Tag Load (0.001597) SELECT tags.* FROM tags INNER JOIN taggings ON tags.id = taggings.tag_id WHERE (taggings.taggable_id = 5 AND taggings.taggable_type = ''Card'') Tag Load (0.002008) SELECT * FROM tags Tag Columns (0.003178) SHOW FIELDS FROM tags Rendered cards/_form (0.02718) Completed in 0.05205 (19 reqs/sec) | Rendering: 0.02855 (54%) | DB: 0.01755 (33%) | 200 OK [http://dev/cards/edit/5]...
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
...(news.id = 13) Rendering within layouts/application Rendering news/show Tagging Columns (0.000286) SHOW FIELDS FROM taggings Tag Load (0.000444) SELECT tags.* FROM tags INNER JOIN taggings ON tags.id = taggings.tag_id WHERE ((taggings.taggable_type = ''News'') AND (taggings.taggable_id = 13)) Tag Columns (0.000187) SHOW FIELDS FROM tags Rendered /news/_item (0.00561) Comment Load (0.000301) SELECT * FROM comments WHERE (comments.commentable_id = 13 AND comments.commentable_type = ''News'') Comment Columns (0.000248) SHOW FIELDS FROM comments User Col...
2006 Mar 31
14
[newbi] Create a Model
Hello All, Yesterday i put RoR with Locomotive. I am very happy :p. So I follow this tuto (http://developer.apple.com/tools/rubyonrails.html). I used Sqlite. my database.yml # MySQL (default setup). Versions 4.1 and 5.0 are recommended. # # Get the fast C bindings: # gem install mysql # (on OS X: gem install mysql -- --include=/usr/local/lib) # And be sure to use new-style password
2006 Jul 14
5
Acts_As_Taggable Plugin multiple controllers.
...nt to return the hr document because the sales document is for sales people only. I''m guessing I need to filter it somewhere but haven''t found the place yet. taggings db create_table :taggings do |t| t.column :tag_id, :integer #id of tagged object t.column :taggable_id, :integer #type of object tagged t.column :taggable_type, :string end thanks in advance john