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

Compatibility with spree_static_content extension #32

Open
Wootenblatz opened this issue Apr 24, 2013 · 0 comments
Open

Compatibility with spree_static_content extension #32

Wootenblatz opened this issue Apr 24, 2013 · 0 comments

Comments

@Wootenblatz
Copy link

I am working on a project that uses this extension and spree_static_content. After getting this extension running all of my static content pages threw an error as follows:

ActionView::Template::Error (undefined method available_facets' for nil:NilClass): 1: <nav id="taxonomies" class="sidebar-item" data-hook><% 2: facets = @searcher.available_facets || [] 3: taxon_names = @taxon ? @taxon.self_and_descendants.map(&:name) : [] 4: for facet in facets 5: options = facet.options spree_core (1.3.2) app/views/spree/shared/_taxonomies.html.erb:2:in_ea1d5b61095c876e70e1dc33471f3255'

With a little digging I can see this error started showing up because of the override to put facets in the sidebar. spree_static_content's main controller inherits from Spree::StoreController and probably is not creating the corresponding @searcher variable that _facets.html.erb is expecting.

A conditional inside the facets partial solved this problem for me. That strikes me as more of a bandaid than an actual fix. Because other extensions may update/pollute/change the sidebar in spree it seems like the @searcher variable needs to be instantiated in a more persistant way? Unfortunately I do not know enough about this extension yet to say if that is worth doing or even the right solution.

I did publish my quick fix for this and can issue a pull request if you like:
Wootenblatz@e49fccd

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

No branches or pull requests

1 participant