Created
August 31, 2010 13:42
-
-
Save dwaynemac/559033 to your computer and use it in GitHub Desktop.
Achieven nested tags
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.gem "acts-as-taggable-on", :source => "http://gemcutter.org", :version => '2.0.0.rc1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./script/generate acts_as_taggable_on_migration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./script/plugin install http://github.com/rails/acts_as_tree.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NestedTags < ActiveRecord::Migration | |
def self.up | |
add_column :tags, :parent_id, :integer | |
end | |
def self.down | |
remove_column :tags, :parent_id | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tag < ActiveRecord::Base | |
acts_as_tree | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment