-
-
Notifications
You must be signed in to change notification settings - Fork 588
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
Scope doesn't update when underlying record is changed #16
Comments
Thanks, I think your explanation is actually crystal clear. I'll work on a patch for that, but it will likely not be ready today. Probably Thursday or Friday. I have a few other bugs related to scopes to work on, as well as a contributed patch pending, so I'll be doing a small overhaul of the scope features. In the mean time I'd suggest not using cached slugs if this is causing problems for your application, and count on being able to turn them back on by early next week at latest. |
no problem -- thanks again for your work on this! |
Removing cached slugs isn't a viable workaround as the scope is still not updated in the slugs table. |
I believe I am experiencing the same issue. I have an application where I have: Is this the issue that is being discussed here? Thanks! |
@meskyanichi yes, that sounds like it's the same issue. I have a received a pull request for a patch which fixes this issue. I'm currently on vacation and will be back home on Tuesday; I'll apply the patch then. In the mean time, you can check out this fork and see if it works for you. |
Hi Norman. Thanks for the reply. Also, after installing the fork gem I receive this error: Which I noticed was added in the fork. But apparently it could not find it or something. Anyway no rush or anything, just pointing it out. And thanks for building such a sweet gem, it's a great solution and I started using it on every project! This just happens to be the first one I'm scoping with. :) |
Updating models used as scope now updates scoped slugs. Closed by 635cc0c. |
Thanks a bunch! I will try it out soon and let you know! |
Ah, I didn't realize Github parses the commit messages to automatically close issues now. I had actually intended to leave this open until I pull in @amiablecoder's changes to the master branch. Right now edge and master are significantly different; it was much easier to fix in edge so that's already done. You may wish to give the edge branch a try; all tests pass and I won't be making any more major changes before releasing 2.3.0, though of course there may be bugs. It's a pretty significant refactor. @amiablecoder the only major issue I've seen so far with the fork is that it doesn't work when the model used as the scope uses slugs, I think it should work with both slugged and non-slugged. |
@amiablecoder Hi, It seems that you've resolved my problem! When I update my top-level association. All children beneath that, and all children beneath these children will get their scopes updated as needed. Thanks a lot for this fix! |
Sorry for another issue...
When you have a scoped slug, and the name of the scope changes, the slugs are not updated. i.e. I have users and posts, and there's the option :scope => :user. When I change the friendly_id of the user (which is name), the scope of the posts is not updated, and therefore they cannot be found by the find_one method (which is looking for an item with the new scope)
Let me know if you need a more concrete example. Thanks for the help with this awesome gem!
The text was updated successfully, but these errors were encountered: