Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…able_on_steroids@338 20afb1e0-9c0e-0410-9884-91ed27886737
  • Loading branch information
jonathan committed Oct 3, 2007
1 parent 2df798e commit fe28448
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,3 +1,9 @@
[3 October 2007]

# Improve documentation.

* Fix TagsHelper and test.

[2 October 2007]

* Remove TagList.parse, use TagList.from instead.
Expand Down
9 changes: 5 additions & 4 deletions README
Expand Up @@ -11,10 +11,9 @@ If you find this plugin useful, please consider a donation to show your support!
This plugin is based on acts_as_taggable by DHH but includes extras
such as tests, smarter tag assignment, and tag cloud calculations.

== Resources
== Installation

Install
* script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids
ruby script/plugin install http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids

== Usage

Expand All @@ -27,7 +26,7 @@ Generate and apply the migration:

=== Basic tagging

Let's suppose we have users that have many posts and we want those posts to be able to be tagged by the user.
Let's suppose users have many posts and we want those posts to have tags.
The first step is to add +acts_as_taggable+ to the Post class:

class Post < ActiveRecord::Base
Expand Down Expand Up @@ -60,6 +59,8 @@ By default, find_tagged_with will find objects that have any of the given tags.
find only objects that are tagged with all the given tags, use match_all.

Post.find_tagged_with('Funny, Silly', :match_all => true)

See <tt>ActiveRecord::Acts::Taggable::InstanceMethods</tt> for more methods and options.

=== Tag cloud calculations

Expand Down
6 changes: 3 additions & 3 deletions lib/acts_as_taggable.rb
@@ -1,12 +1,12 @@
module ActiveRecord
module ActiveRecord #:nodoc:
module Acts #:nodoc:
module Taggable #:nodoc:
def self.included(base)
base.extend(ClassMethods)
end

module ClassMethods
def acts_as_taggable(options = {})
def acts_as_taggable
has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag
has_many :tags, :through => :taggings

Expand Down Expand Up @@ -172,7 +172,7 @@ def tag_counts(options = {})
self.class.tag_counts({ :conditions => ["#{Tag.table_name}.name IN (?)", tag_list] }.reverse_merge!(options))
end

def reload_with_tag_list(*args)
def reload_with_tag_list(*args) #:nodoc:
@tag_list = nil
reload_without_tag_list(*args)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/tag_counts_extension.rb
@@ -1,2 +1,3 @@
module TagCountsExtension
# Deprecated
module TagCountsExtension #:nodoc:
end
2 changes: 1 addition & 1 deletion lib/tagging.rb
@@ -1,4 +1,4 @@
class Tagging < ActiveRecord::Base
class Tagging < ActiveRecord::Base #:nodoc:
belongs_to :tag
belongs_to :taggable, :polymorphic => true
end
1 change: 1 addition & 0 deletions lib/tags_helper.rb
@@ -1,4 +1,5 @@
module TagsHelper
# See the README for an example using tag_cloud.
def tag_cloud(tags, classes)
max_count = tags.sort_by(&:count).last.count.to_f

Expand Down

0 comments on commit fe28448

Please sign in to comment.