-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Collection link for STI model #2813
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
Comments
Have you tried using:
From: https://administrate-demo.herokuapp.com/customizing_dashboards It is listed as deprecated but it's something we've realised can't be removed. |
I tested this: But still with this no link are created when rendering the line in the collection table, so no click are possible. But going to /admin/messages/id correctly display the item. I would like to have this link added directly in the index page or the collection in the Show page with a field that use the hasMany. Using the class_name seems to detect the correct the dashboard, but no link are created on the index. |
It looks like the problem comes from this method in application_helper.rb
No where we check the property class_name here and we keep the target name. |
Ah, I see. This seems like a bug we should go about fixing. Would you be able to contribute a PR for that? |
Currently I don't have the time to do so but maybe on my day off I will take a look at it. |
I may have a quick fix that could work but I don't know if this is the best way to do it. Keep in mind the code is just a early version. Inside the accessible_action? method we could check for the presence of a base class if the target is a ActiveRecord::Base:
But doing so create an error when calling the polymorphic_path method from ActionDispatch inside the And in order to keep compatibility with people that create dedicated path for each sub-class, we need to do this kind of thing: I'm not sure it's the best way to do it and if this is an acceptable solution, is it better to introduce an helper function that transform the resource and return it, or do the transformation inside the html. What do you think ? |
We're facing the same issue. Any progress on this? @gh-axel-czarniak @nickcharlton. Fix would be much appreciated 🙏 |
Hello, no solution on my side. Still waiting for an answer from maintainer |
Hello, I have a dashboard that have multiple items in a collection. In the dashboard, I have this relation:
messages: Field::HasMany.with_options(sort_by: :created_at, direction: :desc)
My message class is an STI and only use child as real type. For example:
class Request < Message
Currently, in this display, each line isn't clickable because the class is Request instead of Message.
How can I make the STI subclass use the main class for all things related to Administrate (route, dashboard, etc).
The text was updated successfully, but these errors were encountered: