开发者

Nested taxon url is no longer working

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
 开发者_C百科   @taxon ? @taxon.name : nil
  end
end


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜