RailsCasts Pro episodes are now free!

Learn more or hide this

Jack Russell's Profile

GitHub User: jackpipe

Site: theorent.com

Comments by Jack Russell

Avatar

A couple of things I found:

  • The subtree.arrange scope does not work if you have a default scope on your model, you also cannot use the inline unscoped method to undo the default scope, as this also undoes the 'subtree' scope. You have to use
ruby
Model.unscoped do
  @model.subtree.arrange
end
  • The recursive function given in the cast does not correctly handle the situation where you have siblings in the subtree. In this case it incorrectly emits empty <div> sections.

  • You must add attr_accessible :parent_id or some other accommodation so that adding new sub-messages does not produce a mass-assignment exception.