Tag: simple form for

无路由匹配:使用嵌套命名空间时缺少必需的

这是我的routes.rb填充 Rails.application.routes.draw do namespace :main, path: ‘:master_url’ do root ‘sites#index’ namespace :dashboard do root ‘dashboards#index’ #get ‘masters/index’ resources :masters end get “/:action” => ‘sites#:action’ end root ‘main/sites#index’ end 这是命令耙路线 main_root GET /:master_url(.:format) main/sites#index main_dashboard_root GET /:master_url/dashboard(.:format) main/dashboard/dashboards#index main_dashboard_masters GET /:master_url/dashboard/masters(.:format) main/dashboard/masters#index POST /:master_url/dashboard/masters(.:format) main/dashboard/masters#create new_main_dashboard_master GET /:master_url/dashboard/masters/new(.:format) main/dashboard/masters#new edit_main_dashboard_master GET /:master_url/dashboard/masters/:id/edit(.:format) main/dashboard/masters#edit main_dashboard_master GET /:master_url/dashboard/masters/:id(.:format) […]

Rails中的模块路由with form_for(@object)

我有命名空间Controller Entities :: Customers class Entities::CustomersController < ApplicationController … end 和命名空间的ActiveRecord模型: class Entities::Customer < Entities::User end 在我的routes.rb文件中我有: resources :customers, module: :entities 模块:实体在那里,因为我不想拥有如下路线: / entities / customers但仅限于: /客户 。 问题在我渲染表单时开始: 抛出错误:类的未定义方法`entities_customer_path’.. 所以错误是rails认为正确的路径是前缀实体。 耙路给我: Prefix Verb URI Pattern Controller#Action customers GET /customers(.:format) entities/customers#index POST /customers(.:format) entities/customers#create new_customer GET /customers/new(.:format) entities/customers#new edit_customer GET /customers/:id/edit(.:format) entities/customers#edit customer GET /customers/:id(.:format) […]