Address the models/resources -> routes debacle #846
adrianthedev
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's confusion in Avo regarding resource generation.
Scenario:
We use the
pay
gem and want to show the subscriptions inside Avo.We start by generating a resource
r g avo:resource subscription
. Next, we have to change themodel_class
toPay::Subscription
. Now we notice that the path generated for that resource is/avo/resources/pay_subscriptions
.Notice the
pay_subscriptions
. We might expect it to besubscriptions
.SubscriptionResource
turns tosubscription
notpay_subscriptions
. Next we'll notice that the generated controller for that resourceSubscriptionsController
does not work. We have to manually change it toPaySubscriptionsController
for it to work.That's because we went from the assumption that the routes should be generated based on the model, and not the resource.
Cons
That's bad (as @yrashk mentioned) because if we'd like to use multiple resources for the same model, that wouldn't really work out of the box.
We're open to suggestions on if we should or shouldn't move the routing from the model to the resource.
Beta Was this translation helpful? Give feedback.
All reactions