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

♻️ Favor asking about model_name over class #934

Merged
merged 1 commit into from
Mar 8, 2024

Commits on Mar 8, 2024

  1. ♻️ Favor asking about model_name over class

    Given our effort at lazy migration in Bulkrax we want to do a bit more
    sniffing regarding the objects.  This is not quite adequate for the
    general case of Collections but it is an improvement.
    
    Ideally we should be interrogating the class and asking
    `klass.collection?` but there are some confounding edge cases around
    routing that we are in this pickle.
    
    ```ruby
    irb(main):002:0> CollectionResource.model_name
    =>
     @collection="collections",
     @element="collection",
     @Human="Collection",
     @i18n_key=:collection,
     @klass=CollectionResource,
     @name="CollectionResource",
     @param_key="collection",
     @plural="collections",
     @route_key="collections",
     @Singular="collection",
     @singular_route_key="collection">
    irb(main):003:0> Collection.model_name
    =>
     @collection="collections",
     @element="collection",
     @Human="Collection",
     @i18n_key=:collection,
     @klass=Collection,
     @name="Collection",
     @param_key="collection",
     @plural="collections",
     @route_key="collections",
     @Singular="collection",
     @singular_route_key="collection">
    irb(main):004:0>
    ```
    jeremyf committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    c9af355 View commit details
    Browse the repository at this point in the history