Administrate and User model doesnt allow changing the find_resource
Im using a public_uid string for lookup on my models. Everything works great for one model, but for the User model I get this error:
NoMethodError in Admin::UsersController#show undefined method `find_by_public_uid' for Admin::User:Module
Here is my override in the Admin user controller
def find_resource(param) User.find_by_public_uid(param) end
On another note whenever I try to regenerate the administrate dashboard for the user model I get an error unless I comment out this line:
include UserAgreements, UserTeams
This is the offending part of the stack trace for that/home/dring/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/bundler/gems/administrate-aa1df6d8b294/lib/generators/administrate/dashboard/dashboard_generator.rb:127:in `association_type': undefined method `has_one?' for nil:NilClass (NoMethodError)
Your error said it was trying to use Admin::User, not the global User, so I'd guess that's the problem. Try making your override use the global User class.
def find_resource(param) ::User.find_by_public_uid(param) end
I'm still hoping that we get some time to finish Madmin so we can ditch Administrate.
Notifications
You’re not receiving notifications from this thread.