tags_controller.rb:
def index
@title = "tags"
@posts = Post.tag_counts.collect do |tag|
Post.tagged_with(tag).first(:order => "updated_at DESC")
end
@posts.uniq!
end
tags/index.html.rb:
<%= render 'latest' %>
_latest.html.erb:
<%- for post in @posts -%>
<%- post.tags.each do |t| -%>
<%= link_to t.name, tag_path(t...
Hello, guys!
I have model with tag context:
class Product < ActiveRecord::Base
acts_as_taggable_on :categories
end
I'm trying to initialize tags caching:
class AddCachedCategoryListToProducts < ActiveRecord::Migration
def self.up
add_column :products, :cached_category_list, :string
Product.reset_column_information
...
How can I get all the tags for a model's associated models using acts-as-taggable-on?
I have the following models, and want to build a list of tags that the network's associated offers have:
class Network < ActiveRecord::Base
has_many :offers
end
class Offer < ActiveRecord::Base
acts_as_taggable
belongs_to :network
end
How d...
I'm using acts_as_taggable_on to add tags to posts, other tagging plugins/gems don't work with rails 3. I can edit/display tags on the post model and the tags controller displays the posts tagged by name i.e /tags/post-tag-name/.
The functionality I want is to turn the tags on the posts pages into links to display the other posts with th...