0

我正在尝试将我的自定义控制器添加到 spree 1.3.1 的管理部分,但我失败了。我想在顶部菜单中查看我的 contoller.index.html 的 url。我已经这样做了:

/controllers/spree/admin/parsers_controller.rb:

module Spree
  module Admin
    #class ParsersController < Spree::Admin::BaseController
    class ParsersController <  Spree::Admin::ResourceController
      def index

      end

    end
  end
end

污损:

Deface::Override.new(:virtual_path => "spree/layouts/admin",
                     :name => "admin_content_admin_tab_parser",
                     :insert_bottom => "[data-hook='admin_tabs']",
                     :text => "<%= tab :parsers,  :url => spree.admin_parsers_path, :icon => 'icon-th-large' %>",
                     :disabled => false)

路线.rb:

Spree::Core::Engine.routes.prepend do
  namespace :admin do
    resources :parsers
    end
end

index.html.erb

<h1>Parser index.html</h1>

我收到错误:

您的收据给出了同样的错误:

NoMethodError in Spree/admin/overview#index
Showing /home/ssa/spree-1.3.1-0/ruby/lib/ruby/gems/1.9.1/gems/spree_core-1.3.1/app/views/spree/layouts/admin.html.erb where line #54 raised:

undefined method `admin_parsers_path' for #<ActionDispatch::Routing::RoutesProxy:0x0000000612a560>
Extracted source (around line #54):

51:           <div class="sixteen columns main-menu-wrapper">
52:             <ul data-hook="admin_tabs" class="inline-menu fullwidth-menu">
53: <%= render :partial => 'spree/admin/shared/tabs' %>
54:             <%= tab(:promotions, :url => spree.admin_promotions_path, :icon => 'icon-bullhorn') %><%= tab(:users, :url => spree.admin_users_path, :icon => 'icon-user') %><%= tab :parsers,  :url => spree.admin_parsers_path, :icon => 'icon-th-large' %>
55: </ul>
56: </div> 
57:         </div> 

我做错了什么?

4

1 回答 1

1

好的,所以问题很简单: 为什么我得到“未定义的方法 `assert_valid_keys`”?

不能在我的模型中声明:belongs_to :aThingA, :aThingB 需要:

belongs_to :aThingA
belongs_to :aThingB 
于 2013-02-10T12:25:01.307 回答