railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.87k stars 2.25k forks source link

Undefined method `to_sym' for nil:NilClass #3624

Open drcarrasco opened 1 year ago

drcarrasco commented 1 year ago

Describe the bug For some reason, some classes don't have names, and this is causing the app to crash.

Reproduction steps I don't understand why my class doesn't have a name.

Expected behavior Rails Admin will work correctly.

Additional context

I think that all instances of to_sym should be preceded by try. Is there a specific reason why try was only added to RailsAdmin::AbstractModel? https://github.com/railsadminteam/rails_admin/blob/5a958e46e8620fba320e04347d326d058c07d396/lib/rails_admin/config.rb#L215-L243

My code enters the Class, ConstLoadSuppressor::ConstProxy condition and crashes.

P.S. Adding try to the base code makes it work correctly.