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

Dashboard does not identify class with namespaces. #2209

Closed
pragatiwagh opened this issue Jun 9, 2022 · 5 comments
Closed

Dashboard does not identify class with namespaces. #2209

pragatiwagh opened this issue Jun 9, 2022 · 5 comments
Assignees
Labels
bug breakages in functionality that is implemented

Comments

@pragatiwagh
Copy link

  • 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
@pablobm
Copy link
Collaborator

pablobm commented Jun 10, 2022

Thank you for the report. We are discussing these issues at #1978 (comment).

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 and let me know if it fixes your issue?

@pragatiwagh
Copy link
Author

pragatiwagh commented Jun 10, 2022 via email

@pablobm pablobm self-assigned this Jul 7, 2022
@SumOys
Copy link

SumOys commented Jul 19, 2022

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

@pragatiwagh
Copy link
Author

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

@pablobm
Copy link
Collaborator

pablobm commented Aug 15, 2022

Fixed by #2235. Thank you all!

@pablobm pablobm closed this as completed Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug breakages in functionality that is implemented
Projects
None yet
Development

No branches or pull requests

3 participants