Created by: gracewashere
Upcase has the following code:
class Mentor < ActiveRecord::Base
# ...
has_many :mentees, class_name: 'User', foreign_key: 'mentor_id'
# ...
end
Before this commit, Administrate incorrectly tries to look up a MenteeDashboard
instead of a UserDashboard
to figure out how to display the association table.
This commit allows developers to specify the class_name
that will be used to look up the proper dashboard for a has_many association.
The option is used like this:
def attribute_types
{
# ...
mentees: Field::HasMany.with_options(class_name: "User"),
# ...
}
end
Background: https://trello.com/c/kypYTxFt