-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Enhancement: Expose scope object #97
Comments
I've been meaning to do this for a while. The idea is to expose the list as an object, which can then act as a scope or whatever required. Considering the object itself may or may not have the word list in it, the names that make more sense to me are Thoughts? |
List sounds fine to me, considering this gem is called acts_as_ list. 😅 Unfortunately I don't understand your second proposal:
Which parent association do you mean? The way I'd currently implement it is to save the passed |
By parent association I meant the association reflected by the scope, but I realized that not all scopes would be associations. |
@ludwigschubert : If you got a chance to tackle this, do let me know. And don't worry about names to begin with, we can always rename them. |
Unfortunately I don't feel confident I understand the entirety of of this gem's use cases well enough to provide a pull request. Naive ImplementationWhat I did originally was a simple method on # Exposes the object the list is scoped to, see #97
def list
self.send(self.scope_name[0..-3])
end This only works when the Nicer WorkaroundI simply went and created a Should this be closed?I'm not sure. I don't think the enhancement request makes sense in all use cases of the gem. If there's a way to only add the |
Hi @ludwigschubert, I'll close this off for now unless time has given you some new inspiration :) |
A
acts_as_list
object should expose its scope object/parent.I'd love to patch and submit a pull request for this myself, but I'd like to discuss naming options, possible alternative solutions, and whether this is a sensible idea at all with you guys first.
Workaround
I
#send
a substring of the scope name to the objectWhy?
This would allow to create awesome nested paths without needing to know about the scope explicitly, such as this reusable navigation snippet:
Naming
Here are some possible names, feel free to chime in on how you like them:
scoped_to
scope_object
scope_parent
parent
imho ambiguousThe text was updated successfully, but these errors were encountered: