-
-
Notifications
You must be signed in to change notification settings - Fork 592
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
Conditionally turn off :dependent => :destory on FriendlyId::Slugs #724
Conversation
@@ -190,6 +190,7 @@ module Base | |||
# @yieldparam config The model class's {FriendlyId::Configuration friendly_id_config}. | |||
def friendly_id(base = nil, options = {}, &block) | |||
yield friendly_id_config if block_given? | |||
friendly_id_config.options = options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for me, it's better to follow existing concept of explicitly specified configuration options and not to add whole hash. By the way, this config is available only for history
module. So, we should clarify this fact in method's documentation above.
Thanks @kimrgrey does this work? |
@vkmita, cool! Looks much better to me 👍 And Travis CI said that everything is ok. I think it's good idea to add some tests for another policies, isn't it? We should at least add test to check that @parndt, what do you think about this PR? As for me it's useful and should be merged. |
…ss is destroyed When using acts_as_paranoid on a sluggable models, we aren't actually deleting the models when calling destroy. If we delete the slugs, we’re losing the history. We're alsosetting up a condition where a unique contstraint may end up being violated
I added a test that checks that :destroy is default. What other policies would you want tested? |
@vkmita, it's enough for me. Let's wait a 👍 from another one contributor to merge it 😉 |
Conditionally turn off :dependent => :destory on FriendlyId::Slugs
Thanks 👍 looks like @norman wanted this for a previous version of FriendlyId and this is a good implementation. |
Hello, I'm trying to use this in one of my models. I was originally using version 5.1, but updated to 5.2 beta just in case. When I add my model has the line:
There isn't a lot of documentation that I could find on this, so this is the best I could come up with. I've tried various rearrangements of this to no avail. Perhaps I need to do something in the friendly_id initializer? If there's any further information I can provide, let me know. Thanks in advance for your help. |
Ah, looks like it may have been my misunderstanding. I checked the beta and found out it wasn't included in that. I switched to master and everything worked as described. Thanks so much for an awesome gem! |
Hey guys!
This adds the ability not to delete historic slugs when the sluggable class is destroyed.
When using
acts_as_paranoid
on sluggable models, we aren't actually deleting the models when calling destroy. If we delete the slugs, we’re losing the history. We're also setting up a condition where a unique constraint ends up getting violated.This is a revival of #268