-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
"The option :class_name is deprecated." but I think it is still needed. #2384
Comments
@jamie, I think this depreciation warning is from your commit. Just wondering if you agree with my assessment here. |
You're seeing
resource_class rather than class_name .
|
Thank you for letting us know of this use case. We'll look into it. Ultimately, we want Administrate to be able to detect all these cases correctly so that we can remove the For now, use what works for you. If you do need
Then when administrate is correctly detecting this case, you can remove the code above and your usage of Having said that... it's possible that this is fixed already in master. Would you be able to check? To do this, reference Administrate in your gemfile like so:
Does that solve your problem? |
I am also running into an issue where this option is still needed. We have this STI set up: class Import < ApplicationRecord
has_many :data_imports, inverse_of: "import" # ideally this would go on Imports::Pdf but it has to be at the top-level due to another Administrate issue module Imports
class Pdf < Import module Imports
class Doc < Import class DataImport < ApplicationRecord
belongs_to :import, class_name: "Imports::Pdf", foreign_key: :import_id, optional: true class DataImportDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
...
import: Field::BelongsTo Without the belongs_to :import, foreign_key: :import_id, optional: true but as a |
Re-reading the original comment, I'm confused by how it's a The example given by @littleforest is definitely a legitimate use case. I've created a PR to undeprecate at #2697 Does anyone have input about the other two deprecated options: |
We tried to remove `:class_name` (along with some others), as it didn't seem like they had a legitimate use as of thoughtbot#2384 and thoughtbot#2546. But we've been seeing various cases where it's still helpful to have. Closes thoughtbot#2384.
I am defining some
ATTRIBUTE_TYPES
in a dashboard. One of my attributes (lead_practitioners
) is abelongs_to
relation where its class name doesn't match the relation name. My model defines thisbelongs_to
relation like so:I am using the
class_name
option when I define the attribute in the dashboard file, like this:which works, but warns me with this:
DEPRECATION WARNING: The option :class_name is deprecated. Administrate should detect it automatically. Please file an issue at https://github.com/thoughtbot/administrate/issues if you think otherwise.
If I remove the
class_name
option and let the Administrate gem try to determine the class name on its own, I get this error:Even if I explicitly add the class name to the model relation, like so:
I get the same error as above.
The text was updated successfully, but these errors were encountered: