Displaying 20 results from an estimated 4000 matches similar to: "polymorphic,has_many through can not work?"
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
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 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 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 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 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 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 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
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 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 =>
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
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:
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)
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 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 May 20
7
Polymorphic, many-to-many, self-referential data model
No matter what I try I''ve been unable to work how to get this to work with
the cool ActiveRecord helpers. I''m not sure if it''s possible, Josh Susser''s
blog suggests it is, but damned if I can work it out...
I have:
Container which can contain one or more Element. An Element is a polymorph
of either a Container or a Chunk. An Element can exist in one or more
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
2011 Jan 15
3
has_many :through with Single Table inheritance
I have the following model structure setup.
class User < ActiveRecord::Base
end
class Parent < User
has_many :relationships
has_many :children,
:class_name => "Student",
:through => :relationships,
:conditions => "related_as = ''parent''"
end
class Student < User
has_many :relationships
2010 Feb 14
2
has_many :through eager loading only loading one record
Hello,
I''ve been using Rails for years, including has_many :through and eager
loading, but this one has me stumped.
The problem is that Active Record is only eager-loading the first of
many records. Here are the models (note set_table_name for a legacy
schema):
class Tag < ActiveRecord::Base
set_table_name ''tag''
end
class DishTag < Tag
has_many
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