Nested taxon url is no longer working

632 views Asked by At

This seems to work on my local, but not on my production.

The number 4 in the error tells me its probably returning nil as it is 4 for any of the Taxon links.

Anyone know what else I can look into?

I clicked this link :

<a href="/t/shirts/">Shirts</a>

my error

ActiveRecord::RecordNotFound (Couldn't find Taxon with ID=4):

my routes

match '/t/*id' => 'taxons#show', :as => :nested_taxons

#produces this line
nested_taxons   /t/*id(.:format)   {:controller=>"taxons", :action=>"show"}

Taxons Controller

class TaxonsController < Spree::BaseController
  #prepend_before_filter :reject_unknown_object, :only => [:show]
  before_filter :load_data, :only => :show
  resource_controller
  actions :show
  helper :products

  private
  def load_data
    @taxon ||= object
    params[:taxon] = @taxon.id
    @searcher = Spree::Config.searcher_class.new(params)
    @products = @searcher.retrieve_products
  end

  def object
    @object ||= end_of_association_chain.find_by_permalink(params[:id] + "/")
  end

  def accurate_title
    @taxon ? @taxon.name : nil
  end
end
1

There are 1 answers

0
Calvin On

None of the permalinks in my database end with /. You might have some luck if you remove that trailing slash from your find_by_permalink call.