【发布时间】:2020-06-06 05:46:30
【问题描述】:
我正在做一个带有 spree + 多供应商市场 gem 的小项目。我想为每个供应商创建一个索引和视图,例如https://spree-multi-vendor-marketplace.com/vendors 和https://spree-multi-vendor-marketplace.com/vendors/c-amare#。
这不是插件的核心,这有点令人沮丧,因为它看起来很基本。
这是我第一次使用 spree,但我看不到控制器。我看不到如何在文档中生成它们所以我创建了一个控制器 app/controllers/spree/vendors_controller.rb
module Spree
class VendorsController
def index
end
def show
end
end
end
我在 config/routes.rb 中添加了路由
Rails.application.routes.draw do
# This line mounts Spree's routes at the root of your application.
# This means, any requests to URLs such as /products, will go to
# Spree::ProductsController.
# If you would like to change where this engine is mounted, simply change the
# :at option to something different.
#
# We ask that you don't use the :as option here, as Spree relies on it being
# the default of "spree".
mount Spree::Core::Engine, at: '/'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
Spree::Core::Engine.routes.draw do
resources :vendors
end
我添加了一个空白视图来测试 app/views/spree/vendors/index.html.erb
现在我得到未定义的方法 `binary_params_for?'对于 Spree::VendorsController:Class
【问题讨论】:
标签: ruby-on-rails spree