Displaying 2 results from an estimated 2 matches for "tag_model".
Did you mean:
mfg_model
2005 Dec 28
3
acts_as_taggable query
...that we can avoid an sql query for the count and jut return the value
of this field in the record. I want to add some code in the taggable.rb to
take care of this. The counter field has the same name as the table name of
the taggable object (items)
def tag(tags, options = {})
....
tag_record = tag_model.find_by_name(name) || tag_model.new(:name => name)
##here is my code
tag_record.table_name +=1
Is this correct?
Vivek
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rai...
2006 Apr 04
5
How to implement tag clouds using plugin?
...one 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)
o, t, o_pk, o_fk, t_pk, t_fk = table_name,
tag_model.table_name, primary_key, taggable_foreign_key,
tag_model.primary_key, tag_foreign_key
jt = tags_join_model ? tags_join_model.table_name :
tags_join_table
sql = "SELECT #{t}.#{t_pk} AS id, #{t}.name AS name, COUNT(*)
AS count FROM #{jt}, #{o}, #{t} WHERE #{jt}.#{t_fk} =...