0

我有一个旧版 Rails 应用程序,它使用了一个非常旧版本的 Spree (spree (0.11.0)),我必须将嵌套资源上移一层。

例如:现在的路径是:/boutique/shop/gourmet-specialties/blah,而我需要将其更改为/boutique/shop/blah,没有美食特色部分。

我找到了生成这些链接的部分:

    <%- if current_taxon && current_taxon.root == taxonomy.root -%>
      <%- taxonomy.root.children.each do |taxon| -%>
        <%- unless taxon_preview(taxon).empty? -%>
        <li<%= ' class="current"' if current_taxon and ([current_taxon] + current_taxon.ancestors).include?(taxon) %>>
          <%= link_to taxon.name, seo_url(taxon), :title => taxon.name %>
        </li>
        <%- end -%>
      <%- end -%>
    <%- end -%>

谁能指导我在 Spree 中如何开始或路线如何运作,以便我可以自己进行?路由文件太多,不知道如何交互。谢谢。

4

1 回答 1

1

路由应该在 config/routes.rb 中指定

这是 Spree 0.11.0 中指定的位置:

https://github.com/spree/spree/blob/v0.11.0/config/routes.rb

Spree 的现代版本是可安装的 Rails 引擎,它将在您的应用程序路由下安装一些自己的路由。但是,您正在处理注入其路线的 rails 2 版本略有不同。您正在处理一个非常旧版本的 Spree,因此您在 Internet 上找到的许多资源都与更现代的 Spree 版本(Rails 3.0+)有关。

您最简单的选择是找出“美食特色菜”的来源并将其删除。如果它来自分类树,请尝试在根分类单元下重新分类。

于 2013-08-14T22:12:07.270 回答