を中にエラーが出る範囲、そして私のルートは、ファイルたびに私の範囲は、私はエラーを取得するたびに私はroutes.rbを私は私のレールのアプリrailscastsに見られるように、私は国際化を実装しようとしています
No route matches [GET] "/"
か":ロケール" 終わりを行う。ここ
missing :controller
config/routes.rb:6:in `block (2 levels) in <top (required)>'
config/routes.rb:5:in `block in <top (required)>'
config/routes.rb:1:in `<top (required)>'
エラー
はJensenlocksmithing::Application.routes.draw do
get "log_out" => "sessions#destroy", as: "log_out"
get "log_in" => "sessions#new", as: "log_in"
scope ":locale" do
get "site/home"
get "site/about_us"
get "site/faq"
get "site/discounts"
get "site/services"
get "site/contact_us"
get "site/admin"
get "site/posts"
root :to => 'site#home'
end
#match '*path', to: redirect("/#{I18n.default_locale}/%{path}")
#match '', to: redirect("/#{I18n.default_locale}")
match "/savesort" => 'site#savesort'
resources :users
resources :abouts
resources :sessions
resources :coupons
resources :monthly_posts
resources :reviews
resources :categories do
collection { post :sort }
resources :children, :controller => :categories, :only => [:index, :new, :create, :new_subcategory]
end
resources :products do
member do
put :move_up
put :move_down
end
end
resources :faqs do
collection { post :sort }
end
end
だから、私は、スコープを追加するたびに、なぜ私のroutes.rbをファイルです私はこれらのエラーを取得するのですか?それはすべてうまく動作しません。これ以上コードを表示する必要がある場合はお知らせください。自分のアプリケーションのコントローラのおかげでみんな
編集
私は、次のしている:
private
def default_url_options(options = {})
{locale: I18n.locale}
end
これはルートにハッシュを渡すことと同じことをするのでしょうか?
編集2
この主旨に見られるように、私は次のように私のルートを変更しました。 https://gist.github.com/2322844
なぜ、:id部分がgetルートに追加されていますか?この1
about_us_site GET /sites/:id/about_us(.:format)
のように、それはこの
about_us_site GET /sites/about_us(.:format)
のようなものであってはならない。また、私の全体のroutes.rbをファイルと、それはより多くの情報のために生成したルートを追加しました。興味のある人のため
https://gist.github.com/2322861
回答:
私は
get "site/home"
get "site/about_us"
get "site/faq"
get "site/discounts"
get "site/services"
get "site/contact_us"
get "site/admin"
get "site/posts"
root :to => 'site#home'
resources :sites, except: [:new, :edit, :index, :show, :update, :destroy, :create] do
collection do
get :home
get :about_us
get :faq
get :discounts
get :services
get :contact_us
get :admin
get :posts
end
に終わり、私を渡す
を私の編集を見て、必要があるハッシュあなたのルートを修正する必要があり、NA default_url_options関数は同じことをしますか? – ruevaughn
私は実際にはわかりません。 'レーキルート'の出力は何ですか? –
実際にアプリケーションコントローラにデフォルトを追加していることが確認されました。あなたが定義した通りに私のルートを標準に変更しましたが、ルートに:idを追加しています。詳細については私の編集を参照してください。もう一度 – ruevaughn