我对 Rails 比较陌生,找不到答案。我添加了一个带有相应视图的控制器。当我去
根/order_build/show?build=1
我收到一个路由错误,提示找不到路径,这是当我单击具有该地址的链接时。在我进入错误页面并手动刷新页面后它可以工作。知道为什么会发生这种情况吗?
class OrderBuildController < ApplicationController
def show
@build= Build.find(request.GET["build"])
end
def order
end
def index
end
end
这是我的路由文件
ProjectD::Application.routes.draw do
get "order_build/show"
get "order_build/order"
get "order_build/index"
get "home/index"
#root :to => "home#index"
root :controller => 'home', :action => :index
resources :users, :user_sessions
match 'login' => 'user_sessions#new', :as => :login
match 'logout' => 'user_sessions#destroy', :as => :logout
resources :sessions
resources :providers
resources :build_prices
resources :products do
resources :product_images
end
resources :product_tags_products
resources :product_tags
resources :product_images
resources :orders
resources :order_statuses
resources :build_prices
resources :builds do
resources :build_prices
end
resources :build_statuses
resources :account_types
end