Displaying 8 results from an estimated 8 matches for "acts_as_taggable_options".
2006 Apr 20
2
acts_as_taggable magic.... please explain
Hi,
There is a line in acts_as_taggable plugin:
send(acts_as_taggable_options[:from]).tags.find_or_create_by_name(name).on(self)
could someone explain what is:
send(xxx)
and
.on(self)
I cannot find it rDoc
--
Posted via http://www.ruby-forum.com/.
2006 May 19
0
Works in model but not in mixin
...anted to switch from the destructive TAG_WITH method
to adding tags while preserving the existing ones. On the surface this
seemed easy enough and eventually I got it working. However, the
following method:
def add_tags(list)
Tag.transaction do
Tag.parse(list).each do |name|
if acts_as_taggable_options[:from]
send(acts_as_taggable_options[:from]).tags.find_or_create_by_name(name).on(self)
else
Tag.find_or_create_by_name(name).on_unique(self)
end
end
end
end
Only works if placed in my model (that has the acts_as_taggable helper)
or in a controller....
2007 Jul 22
2
Seek brilliant Rails programmer to add one field to acts_as_taggable
...#39;'go in the front door'' and simply modify the
''tag_with'' code such as this;
module InstanceMethods
def tag_with(list, project_id)
Tag.transaction do
taggings.destroy_all
Tag.parse(list).each do |name|
if acts_as_taggable_options[:from]
send(acts_as_taggable_options[:from]).tags.create(:name =>
name, :project_id => project_id).on(self)
else
unless Tag.find_by_name(name)
Tag.create(:name => name, :project_id =>
project_id).on(self)
end...
2006 Jun 30
0
find_by_sql not quoting properly (in acts_as_taggable plugin)
...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 directly to pass to find_by_sql, but
I changed it thusly:
trunk/vendor/plugins/acts_as_taggable/lib/acts_...
2006 Feb 16
1
[PATCH] acts_as_taggable plugin
...{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(", ")})"
)
end
+
+ def find_tagged_with_all(list)
+ find_by_sql(
+...
2006 May 06
3
Extending Rails plugins?
...t;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''t crazy no more?
Murdock: Only on paper.
--
Posted with http://DevLists.com. Sign up and save your mailbox.
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 Nov 11
0
acts_as_taggable plugin - paging through tagged model
...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 options[:offset] != nil
find_by_sql([query, acts_as_taggable_options[:taggable_type], list])
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYP...