administrate
administrate copied to clipboard
Dashboard does not identify class with namespaces.
-
What were you trying to do? I had some models inside a particular namespace. These models had some association outside the namespace.
-
What did you end up with (logs, or, even better, example apps are great!)? I had to define class_name in dashboard, but it keeps showing warning that the class_name option is deprecated.
-
What versions are you running?
- Rails - 7
- administrate - latest
Thank you for the report. We are discussing these issues at https://github.com/thoughtbot/administrate/issues/1978#issuecomment-1147267975.
There's currently a fix that I'm testing that may work for you. Would you be able to test the branch https://github.com/thoughtbot/administrate/compare/main...pablobm:namespaced-associations and let me know if it fixes your issue?
Thank you Pablo for your response. I will look into the solution and get back to you.
Regards Wagh Pragati Malhari
On Fri, Jun 10, 2022 at 7:18 PM Pablo Brasero @.***> wrote:
Thank you for the report. We are discussing these issues at #1978 (comment) https://github.com/thoughtbot/administrate/issues/1978#issuecomment-1147267975 .
There's currently a fix that I'm testing that may work for you. Would you be able to test the branch main...pablobm:namespaced-associations https://github.com/thoughtbot/administrate/compare/main...pablobm:namespaced-associations and let me know if it fixes your issue?
— Reply to this email directly, view it on GitHub https://github.com/thoughtbot/administrate/issues/2209#issuecomment-1152382828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISARXSREQ4X2ISYOD3DBXTVONBS5ANCNFSM5YJ2UNVQ . You are receiving this because you authored the thread.Message ID: @.***>
I ran into this same issue recently. The patch on the above branched did work. I put this in config/initializers/overrides.rb
for now
# Needed until the following bug is fixed
# https://github.com/thoughtbot/administrate/issues/2209
Administrate::Field::Associative.class_eval do
def self.associated_class_name(resource_class, attr)
associated_class(resource_class, attr).name
end
end
@pablobm I tried the solution mentioned by @SumOys and it worked for me. Thank you @pablobm @SumOys
Fixed by https://github.com/thoughtbot/administrate/pull/2235. Thank you all!