It does have a tutorial somewhere in Wiki section of github, as long as
I remember.
But all you really need is to install it, declare :lft, :rgt, and
:parent_id in the migration, and put act_as_nested_set in the model. Not
hard at all.
However, note that you should recreate all the existing instances of the
model, so that :lft and :rgt fields will be set.
Cheers,
Gleb
P.S.: From my code:
class MakePlaylistsNested < ActiveRecord::Migration
def self.up
add_column :playlists, :parent_id, :integer
add_column :playlists, :lft, :integer
add_column :playlists, :rgt, :integer
end
def self.down
remove_column :playlists, :parent_id, :lft, :rgt
end
end
class Playlist < ActiveRecord::Base
acts_as_nested_set :scope => :user_id, :depenendent => :destroy
...
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---