Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
axtro opened this issue Mar 16, 2010 · 2 comments
Closed

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

axtro opened this issue Mar 16, 2010 · 2 comments

Comments

@axtro
Copy link

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
Copy link
Author

axtro commented Mar 16, 2010

In my fork at http://github.com/hennk/ancestry 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
Copy link
Owner

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants