From linicks at gmail.com Mon Dec 10 20:15:16 2007 From: linicks at gmail.com (Nick Pavlica) Date: Mon, 10 Dec 2007 18:15:16 -0700 Subject: [Betternestedset-talk] Rails 2.x Support Message-ID: All, I'm a happy user of the "Better Nested Sets Plug in", and have been very happy with the work everyone has done to make life easier, and my code better. Now that Rails 2.0 is out, I'm working to move my application to it. During this migration endeavor the only issue I ran into was during a record update of which I found a fix in the mailing list archive: Fix From List: Open /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/ base.rb, line 2029, and change "attributes_with_quotes(false, false)" by "attributes_with_quotes(false)". My primary concern with this is that it requires a change to ActiveRecord. Is correcting this issue in the plug in a big undertaking? Regards -Nick Pavlica From mr_person at mrperson.org Tue Dec 11 20:43:10 2007 From: mr_person at mrperson.org (Curtis Hawthorne) Date: Tue, 11 Dec 2007 19:43:10 -0600 Subject: [Betternestedset-talk] Validations Message-ID: <475F3CAE.2000508@mrperson.org> Hi all, Is there any way to cause move_to_child_of to trigger a validation check? In my application, there are certain kinds of nodes that aren't allowed to have children. I have code in my validate method to check for this, but it doesn't get called when nodes are moved to different parents. If there isn't a way to do it right now (I didn't see any way to do it), it seems like it should be fairly easy to add. Perhaps just wrap the update_all call in move_to inside a transaction and call save! afterward. I could try to write a patch for this if that sounds like the right way to go. Also, is using the trunk branch in production safe? I noticed that there hasn't been a stable release in quite a while, but there are changes required for compatibility with Rails 2.0 that are only in trunk. Thanks! Curtis H. From linicks at gmail.com Wed Dec 12 09:27:45 2007 From: linicks at gmail.com (Nick Pavlica) Date: Wed, 12 Dec 2007 07:27:45 -0700 Subject: [Betternestedset-talk] Validations In-Reply-To: <475F3CAE.2000508@mrperson.org> References: <475F3CAE.2000508@mrperson.org> Message-ID: "Also, is using the trunk branch in production safe? I noticed that there hasn't been a stable release in quite a while, but there are changes required for compatibility with Rails 2.0 that are only in trunk." I have been using a trunk version that's newer than the current releases in production without any issues. I hadn't realized that the Rails 2.0 issues have already been resolved. I had known, I would be using the newest trunk version rather than making the necessary changes to ActiveRecord. I must have missed that shout out from the developers. Regards! --Nick Pavlica From j at jonathanleighton.com Wed Dec 19 07:42:11 2007 From: j at jonathanleighton.com (Jonathan Leighton) Date: Wed, 19 Dec 2007 12:42:11 +0000 Subject: [Betternestedset-talk] Assignment to parent_id Message-ID: <1198068131.12507.7.camel@tybalt> Hi, First off, thanks for the Better Nested Set plugin :) Second, I wonder if you have seen this comment on the Rails wiki: "It's *silly* that you can't assign parent_id and use an after_create method to automatically move_to_child_of parent_id. Removing those module_evaled method definitions allows you to do this." - Source: http://wiki.rubyonrails.com/rails/pages/BetterNestedSet I agree, but I'd go even further. My ideal way to add a child would be to *just* set the parent id... ideally I'd expect the plugin to handle all the behind-the-scene details for for it to Just Work. I see this has been discussed previously: http://rubyforge.org/pipermail/betternestedset-talk/2007-August/000192.html With regard to reason 2, couldn't assigning to parent_id just "queue up" the changes. It doesn't need to change the database immediately, but could "remember" to do so after_create. I would be willing to write a patch... Cheers, Jon -- Jonathan Leighton, Web Developer http://jonathanleighton.com/