Displaying 20 results from an estimated 2000 matches similar to: "joining and array with a table in ActiveRecord"
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
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
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 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 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,
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
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 =>
2006 Nov 11
0
acts_as_taggable plugin - paging through tagged model
Hi,
I''m using the acts_as_taggable plugin & wanted to page through all a
model''s records taggged with a particular tags.
i.e. page through all Model records that have been tagged with "artist"
I could not work out how to do this with the plugin, so I made the
changes outlined below.
Did I need to do this..? & does anyone else find this useful?
2006 Feb 09
0
acts_as_taggable Generating Funky SQL
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 =>
2006 Jul 14
5
Acts_As_Taggable Plugin multiple controllers.
I have Acts_As_Taggable Plugin working. I have a HR controller and a
sales controller.
I have a document in hr tagged whitepaper and a differnent document in
sales tagged whitepaper
when I am in hr I see the hr document tagged with whitepaper and not
the sale document (what I want). but if I click on the tag whitepaper
I return two documents, hr and sales. I just want to return the hr
document
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
Hi all,
Please excuse the long post, but I wanted to make sure you have all the
information....
I have a NewsModel that looks like this:
class News < ActiveRecord::Base
belongs_to :user
validates_associated :user
validates_length_of :title, :description, :minimum => 5, :allow_nil
=> false
acts_as_commentable
acts_as_taggable
def self.find_recent
News.find(:all,
2006 Nov 04
2
strange errors in dev.log and webserver log
Hi guys,
I have encountered a strange error in one of my applications.
The details are the following:
The application is a very simple one, I have one model, Cards, it has
some pretty basic stuff, some after_save methods for saving uploaded
files to their places.
I have an UI where I can manage the Card records, with the default
methods, including ''edit''
cards_controller.rb:
2005 Sep 06
6
strange behavior of acts_as_taggable
I was testing my models with this new library and I got:
>> s.tag "warp"
ActiveRecord::StatementInvalid: ERROR: inserción o actualización en la tabla
«tags_stories» viola la llave foránea «tags_stories_story_id_fkey»
DETAIL: La llave (story_id)=(8) no está presente en la tabla «stories».
: INSERT INTO tags_stories ("tag_id", "story_id") VALUES
2006 Mar 08
2
Need some brainstorming help: acts_as_taggable_list?
I''m trying to figure out the best way to set this data model up. I''m still
pretty new to Rails, but hopefully I could turn this into something useful
to others as well. Here are the basics:
User has_many items
items are taggable (items habtm taggings, tags habtm taggings)
I also want users to be able to order their tagged items. So if I''ve
tagged 5 items as
2006 Apr 04
5
How to implement tag clouds using plugin?
The code on
http://blog.craz8.com/articles/2005/10/28/acts_as_taggable-is-a-cool-piece-of-code
is based on the acts_as_taggable gem,anybody has done that using the
acts_as_taggable plugin?thanks!
btw:the code above uses the tag_count method,which is defined in the
gem:
def tags_count(options = {})
options = {:order => ''count DESC''}.merge(options)
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/.
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
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 Jun 22
2
id column for join table... kosher?
I''ve got two tables, bookmarks & tags. Using a
has_and_belongs_to_many association, I can do lookups using a join
table called bookmarks_tags. Two questions:
1. Can I have a migration for my join tables? Rails seems to "know"
about join tables implicitly from the associations, but if I do a
rake migrate the join tables won''t be built. I''ve been
2010 Jan 15
1
Chaining queries in ActiveRecord
Hi all,
Stuck at this problem for several days. Tried to use named_scope,
scope_out, and plugin such as searchlogic, but no result.
The problem is as follows: I have a pic table and tag table, and a
join table called pic_tag (with only pic_id and tag_id) so that I can
associate N pics to M tags. This is the tutorial way to set up a many-
to-many association. I''m trying to implement a