Это работает на моем локальном компьютере, но не на моем производстве.
Число 4 в ошибке говорит мне, что оно, вероятно, возвращает nil
, поскольку оно равно 4 для любой из ссылок Таксона.
Кто-нибудь знает, что еще Я могу посмотреть?
Я нажал эту ссылку:
<a href="/t/shirts/">Shirts</a>
моя ошибка
ActiveRecord::RecordNotFound (Couldn't find Taxon with ID=4):
мои маршруты
match '/t/*id' => 'taxons#show', :as => :nested_taxons
#produces this line
nested_taxons /t/*id(.:format) {:controller=>"taxons", :action=>"show"}
Контроллер таксонов
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