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

remove dependency in SearchState #1477

Merged
merged 1 commit into from
Sep 6, 2016

Conversation

codeforkjeff
Copy link

Blacklight::Controller conveniently allows you to override #search_state to provide your own subclass of Blacklight::SearchState. But when I try to create such a subclass, I get an 'uninitialized constant Blacklight::Facet' error, because that's a controller concern that hasn't been loaded yet.

This PR removes that dependency, making it possible to subclass SearchState.

return facet_fields[field] if facet_fields[field] && facet_fields[field].field == field

# Find the facet field configuration for the solr field, or provide a default.
facet_fields.values.find { |v| v.field.to_s == field.to_s } ||

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer detect over find.

@coveralls
Copy link

coveralls commented Aug 31, 2016

Coverage Status

Coverage increased (+0.002%) to 94.627% when pulling 147e5d5 on codeforkjeff:search-state-dependency into 21f9baa on projectblacklight:master.

@atz
Copy link
Member

atz commented Aug 31, 2016

Makes sense to me. We definitely have an overall problem of modules not being properly isolated (anticipating features or dependencies in the includer's context, and not even bothering to check when included whether that is true or not). Can you rebase it?

…ch is a controller concern, by moving #facet_configuration_for_field into Blacklight::Configuration and delegating
@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 94.656% when pulling 0013a6b on codeforkjeff:search-state-dependency into d914c53 on projectblacklight:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 94.656% when pulling 0013a6b on codeforkjeff:search-state-dependency into d914c53 on projectblacklight:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 94.656% when pulling 0013a6b on codeforkjeff:search-state-dependency into d914c53 on projectblacklight:master.

@codeforkjeff
Copy link
Author

Thanks for looking at this so quickly! I've rebased this branch with master.

@jcoyne
Copy link
Member

jcoyne commented Sep 1, 2016

Looks good to me. 👍 Thanks. @codeforkjeff.

@cbeer would you care to take a look?

@atz atz merged commit c38073a into projectblacklight:master Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants