administrate icon indicating copy to clipboard operation
administrate copied to clipboard

Dashboard does not identify class with namespaces.

Open pragatiwagh opened this issue 2 years ago • 4 comments

  • 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

pragatiwagh avatar Jun 09 '22 12:06 pragatiwagh

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?

pablobm avatar Jun 10 '22 13:06 pablobm

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: @.***>

pragatiwagh avatar Jun 10 '22 15:06 pragatiwagh

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

SumOys avatar Jul 19 '22 17:07 SumOys

@pablobm I tried the solution mentioned by @SumOys and it worked for me. Thank you @pablobm @SumOys

pragatiwagh avatar Jul 22 '22 06:07 pragatiwagh

Fixed by https://github.com/thoughtbot/administrate/pull/2235. Thank you all!

pablobm avatar Aug 15 '22 09:08 pablobm