-
Notifications
You must be signed in to change notification settings - Fork 329
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
Please, make single-element list supporting finding record by slugs too, just as .show does #443
Comments
Right now it's using id_condition method on all_conditions, so it's adding condition to where method, and do_show uses find_if_allowed, which uses find method, not where So changing to use find_if_allowed, like do_show, would have some behaviour changes:
Also, loading with a array id works, e.g. /resources?id[]=63429&id[]=63430 looks for id IN (63429, 63430), not sure if it would work for find_if_allowed, probably it does |
Thanks for the explanation. Some my thoughts about it:
It may be not strictly copying What about working with array, you are right: The only thing I continue to warry about, is logic inconsistency in ActiveScaffold's treating of single-element lists, which breaks the "least surprise" principle of Rails and common logic of applications. I meant the following:
According to routing table now we have:
And now is the most interesting part. We need list of the records with action_links.
For now all seems to be OK and non-surprising. Just seems ;)
I probably have to agree with you, that logic in Or, may be, you could just advice me to make some change to my applications in part of forming action_links with proper params, which would make single-element list happy? :) Anyway, it would be nice to have it's behavior documented in the wiki (possibly with link to this issue) for developers to know, that it has different logic and so needs different, non-REST-ful referring in path- and url-helpers to work as expected. Still, I hope it could be implemented in some REST-ful way… |
Hello,
I use ActiveScaffold with one of my models, which supports finding records by slugs (via friendly_id). And I've noticed some strange behavior:
While
.show
works pretty well with this:…but
.index
with id (single-element list) doesn't work (doesn't find the record):As ActiveScaffold already has some solution (
do_show
) which works well, may some part of it be ported todo_list
?P.S. In rails console the difference is in parameter to
find
method:Fremantle::Resource.find("63429")
works well, whileFremantle::Resource.find(63429)
doesn't work.The text was updated successfully, but these errors were encountered: