Skip to content
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

resources() should allow an empty "only" value #1083

Closed
absentbri opened this issue Jul 22, 2021 · 2 comments
Closed

resources() should allow an empty "only" value #1083

absentbri opened this issue Jul 22, 2021 · 2 comments

Comments

@absentbri
Copy link
Contributor

resources(name = "Foo", nested = true, only = "")
  .resources(name = "Bar")
.end()

This does not work as (I'd) expected where I'd like the relationship/nesting but I do not need/cannot use restful routes for the parent, but want to keep the structure (in this case, a legacy app with legacy pre-restful routes).

While not shown explicitly in the docs in rails https://guides.rubyonrails.org/routing.html#restricting-the-routes-created you can use an empty array only: [] to not have any routes at all, this shows up in testing and also mentioned in this SO answer: https://stackoverflow.com/a/27425638

Can we allow only to be passed as an empty list/string and be accepted?

@neokoenig
Copy link
Contributor

I don't see a problem with this; should be do-able.
Temp workarounds could be achieved via:

.resources(name = "Foo", nested = true, except = "index,show,edit,create,new,delete,update")
	.resources(name = "Bar")
.end()

But I appreciate that's a bit ugly

@absentbri
Copy link
Contributor Author

@neokoenig yep, that's exactly how I did it :)
I'll try for a PR to change it soon maybe, its quite minor

absentbri added a commit to absentbri/cfwheels that referenced this issue Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants