similar to: Polymorphic :through associations

Displaying 20 results from an estimated 500 matches similar to: "Polymorphic :through associations"

2006 Apr 21
3
polymorphic,has_many through can not work?
Josh Susser tells in his blog that the opposite direction of polymorphic will get into trouble together with has_many through. This is the url: http://blog.hasmanythrough.com/articles/2006/04/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
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
2006 Feb 16
1
[PATCH] acts_as_taggable plugin
hi, I started today to use the acts as taggable plugin and it''s working as expected. I added a method find_tagged_with_all since I needed to find the elements tagged with all the items in a list while find_tagged_with finds all the elements tagged with any of the list terms. Attached to this mail there''s a patch which adds the find_tagged_with_all method and which solves a
2006 Feb 09
3
acts_as_taggable Produces Bad SQL - Find Fails
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 =>
2012 Sep 08
3
Polymorphic has_and_belongs_to_many association
Hi, I''m currently having the situation where I have to implement a polymorphic has_and_belongs_to_many by introducing an in between model that handles all the "has_many :as" and "belongs_to :polymorphic" association implementations... and is not doing anything else. Thing I don''t like it here is, I am unnecessarily loading AR instances only to execute SQL
2006 May 06
3
Extending Rails plugins?
Gents, I''m using the acts_as_taggable rails plugin (not gem), and would like to add some additional methods to it. For example, the find_tagged_with methods essentially does a find tag in a list (effectively an OR), while I''d like to implement a find_tagged_with_all method that would implement an AND (so if I specified 4 tags, it would only return items that were
2009 Sep 11
0
Need help with extending a plugin
hey folks I''ve installed the plugin acts_as_taggable_on_steroids (henceforth aatos), and i already have some tagging functionality set up, using the same approach (ie a Tag and a Tagging class with associated tables) as aatos. So, i want my existing Tag and Taggings methods, plus some other methods i have in a module which i include with the taggable classes (ie the ones that would call
2007 Apr 23
3
Troubles with using gems in Rails
Hi! I''m observing some problems using gem inside Rails. My understanding is that after following sequence in irb: $ irb irb(main):001:0> require ''rubygems'' => true irb(main):002:0> require ''active_record'' => true irb(main):003:0> gem ''acts_as_taggable'' => true I should have access to acts_as_tagable mixins, like:
2009 Nov 12
0
Problem with has_many :through, :uniq => true with polymorph
Didn''t have quite enough space to describe it there...basically i''m having a problem with the :uniq option in my tags. I''m using acts_as_taggable_on_steroid which adds these associations to my Resource class: Resource has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag has_many :tags, :through => :taggings, :uniq => true
2006 May 07
6
Challenging SQL for you...
Gents, My heads been out of the sql game for too long (or it''s simply too early). I''m trying to extend the acts_as_taggable plugin (note: not gem) so that you can specify a list of tags you''re interested in, and the plugin will return only those items that are tagged with *all* these tags. The plugin uses primarily two tables: tags, to keep all the various tag
2006 Apr 06
0
How to use polymorphic in a beautiful way in such a case?
class User<ActiveRecord::Base has_many :taggings, :as=>:taggable,:dependent=>true has_many :tags,:through=>:taggings end class Article<ActiveRecord::Base has_many :taggings, :as=>:taggable,:dependent=>true has_many :tags,:through=>:taggings end class Tagging<ActiveRecord::Base belongs_to :tag belongs_to :taggable,:polymorphic=>true end class Tag<ActiveRecord::Base
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 Jul 10
2
Polymorphic associations in reverse?
My app has an association that''s got me scratching my head. I have Users, and Images. A User has many Images. (Yes, another picture sharing app, but it''s for a small niche, and it doesn''t end in -r!) I would like to express a "Favorite" relationship between both Users to Users, and Users to Images. This seems like the opposite of the standard
2006 Apr 01
3
acts_as_taggable, wrong number of arguments
Hello, When I try: @tagged_items = Problem.find_tagged_with :all => ''kuba'' or @tagged_items = Problem.tags_count :limit => 100 I get this error: ArgumentError in Volume#index wrong number of arguments (2 for 3) RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace
2005 Dec 28
3
acts_as_taggable query
Hi , I couldnt find any mailing list for this nice plugin so I hope this is not off topic.I just have a basic question here. I already had created a table and a model for the tags and items and the join table and now want to use this plugin but I just cant seem to figure out how to make it use my table instead of the default. class Tag < ActiveRecord::Base # already exists and has the
2006 Jun 30
0
find_by_sql not quoting properly (in acts_as_taggable plugin)
I have run into a very strange problem discovered through the use of the acts_as_taggable plugin, but related to quoting/sanitizing the interpolated list in a find_by_sql. Apologies for the 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,
2004 Sep 10
1
Query on image link file mode?
Hiya, will it be possible to add single song playback support like Monkey's Audio Image Link File to FLAC+CUE? This will allow the playing of single songs from 1 large FLAC file. Since FLAC can already embed the cuesheet inside the FLAC itself, the next step will be to allow the playback of the songs individually, allowing them to be added to playlists when playing singles. Please make
2006 Jun 22
1
acts_as_taggable gem problems
With acts_as_taggable 1.04... 1. how can I get a frequency of tags? i.e. /tags/list I want to list of tags sorted and listed with their frequency tags_controller.rb: def list @tags = Tags.find_by_sql ''select name, count(*) as freq from tags group by name order by freq desc'' End tags/list.rb: <ul> <% @tags.each do |t| %> <li><%= t.freq %>
2008 Oct 02
1
acts_as_taggable_on environment issues
Like most people, I''ve got two machines: one for development and one for production. I''ve done everything I can to make sure the ruby/rails environments are the same, but of course they''re not identical (I''ll get into that in a moment). The error that I''m getting happens when I call a method in a background task controller on the production machine; I
2011 Mar 15
1
Acts as taggable on ( tag ownership question )
From the acts as taggable doc I seeTag Ownership Tags can have owners: class User < ActiveRecord::Base acts_as_tagger end class Photo < ActiveRecord::Base acts_as_taggable_on :locations end @some_user.tag(@some_photo, :with => "paris, normandy", :on => :locations) @some_user.owned_taggings @some_user.owned_tags