-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
attr_protected on cache_slugs #10
Comments
Ah, that's too bad - I didn't realize this would happen. I'd prefer not to add yet another option to friendly_id if I can avoid it. What you would think of overriding the #{cache_column}= method by default in order to protect it? |
Not sure it's a good idea. I think it will break the way the cache column is assigned in the plugin but it can be changed. |
Ok, I have made it so that if attr_accessible has been invoked, attr_protected will not be used. This requires that the invocation of attr_accessible occur BEFORE the invocation of has_friendly_id, which is a little ugly and inconvenient, but I can live with it. I added documentation to the README and to the rdocs. New release coming shortly. |
Cool, It works well for me, and I find that cleaner that overriding the #{cache_column}= method. |
Hi,
friendly_id automatically makes a call to attr_protected on the cache column. This is a good thing except when the model uses attr_accessible. In that case, Rails blows up: "Declare either attr_protected or attr_accessible for YourModel, but not both."
Maybe friendly_id should let the developer disable this :
has_friendly_id :title, :protected => false
The text was updated successfully, but these errors were encountered: