Skip to content

Commit

Permalink
[frontend] Load taxon if params[:taxon] exists in ProductsController
Browse files Browse the repository at this point in the history
Fixes a small bug where searching *twice* for the same term results in the taxon 'scope' being forgotten
  • Loading branch information
radar committed May 13, 2014
1 parent a4f0ed8 commit 90ae136
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/app/controllers/spree/products_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Spree
class ProductsController < Spree::StoreController
before_filter :load_product, :only => :show
before_filter :load_taxon, :only => :index

rescue_from ActiveRecord::RecordNotFound, :with => :render_404
helper 'spree/taxons'

Expand Down Expand Up @@ -31,5 +33,9 @@ def load_product
end
@product = @products.friendly.find(params[:id])
end

def load_taxon
@taxon = Spree::Taxon.find(params[:taxon]) if params[:taxon].present?
end
end
end

0 comments on commit 90ae136

Please sign in to comment.