我正在尝试将自定义控制器添加到spree 1.3.1中的admin部分 我失败了。我想在顶部菜单中看到我的contoller.index.html的网址。我做了那个:
/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)
routes.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>
我做错了什么?
答案 0 :(得分:1)
好的,问题很简单: Why am I getting "undefined method `assert_valid_keys`"?
无法在我的模型中声明:belongs_to :aThingA, :aThingB
需要:
belongs_to :aThingA
belongs_to :aThingB