ancestry column cannot be a mass-assign protected attribute #21

axtro opened this Issue Mar 16, 2010 · 2 comments


None yet
2 participants

axtro commented Mar 16, 2010

It seems to me that the ancestry column has to be included in attr_accessible. If it is not, the update_descendants_with_new_ancestry will fail, as it uses update_attributes to set the new ancestry.

Was this done on purpose? I would prefer that my users do not have direct access to that column but use special setters for reordering items, in order to more easily control what and where to they can move stuff.

axtro commented Mar 16, 2010

In my fork at I changed all updates to the ancestry column to use update_attribute, which ignores protected attributes.

Btw, I had some problems getting the tests to run. I created a new rails app, created a git checkout in vendor/plugins and tried to run the test but it always complained that the "has_ancestry" method was unknown.

In the end I had to change the plugin's init.rb to change the load path and require it from has_ancestry_test.rb, and use the mysql adapter. Any tips on how to do this without those hacks?


stefankroes commented Oct 24, 2010

I fixed the brittle test suite and it is now easy to check out the repo and run the tests against multiple databases and versions or AR. I will look into the assignment issue shortly.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment