2012-04-19 3 views
0

サイトをオーナー/管理者に名前を変更してルーティングエラーが発生しようとしています。私は新しい財務報告書を作成してみます(http:// localhostを:3000/EN /管理/ financial_reports /新)私はここで 名前空間ルーティングファイルでルーティングエラーが発生する

No route matches {:controller=>"financial_reports", :format=>nil} 

は(短縮)私のroutes.rbを

scope ":locale", locale: /#{I18n.available_locales.join("|")}/ do 
root :to => 'sites#index' 
get "logout" => "sessions#destroy", :as => "logout" 
get "login" => "sessions#new", as: "login" 
namespace :admin do 
    root :to => "base#index" 
    resources :financial_reports do 
     collection do 
     get :monthly 
     get :yearly 
     end 
    end 
    end 
namespace :owner do 
    root :to => "base#index" 
    end 
match "*path", to: "sites#not_found" # handles /en/fake/path/whatever 
end 
root to: redirect("/#{I18n.default_locale}") # handles/
match '*path', to: redirect("/#{I18n.default_locale}/%{path}") 
end 
あり得る

は、ここに私のコントローラ アプリ/コントローラ/管理/ financial_reports_controller.rb

class Admin::FinancialReportsController < BaseController 

デフ指数 @financial_reports = FinancialReport.alですL 端

DEF新しい @financial_report = FinancialReport.new 端

DEF @financial_report = FinancialReport.new(paramsは[:financial_report])を作成 を@場合 フラッシュfinancial_report.save [:通知] [:警告] = 「インデックス」 終了 エンド DEFをレンダリング「ではない正常にアップロード財務報告書」= redirect_toのroot_url 他 フラッシュの財務報告書は正常にアップロード "毎年 @financial_reports = FinancialReport.yearly エンド デフ毎月 @financial_reports = FinancialReport.monthly エンド エンド

と私の見解

アプリ/ビュー/管理/ financial_reports/new.html.erb

<%= form_for(@financial_report) do |f| %> 
<p> 
    <%= f.label(:report_type) %> <br> 
    <%= f.radio_button :report_type, "Monthly" %> Monthly | 
    <%= f.radio_button :report_type, "Yearly" %> Yearly 
</p> 
<p> 
    <%= f.file_field :file %> 
</p> 
<p> 
    <%= f.submit "Upload Monthly Record" %> 
</p> 
<% end %> 

なぜこのエラーが発生するのですか?おかげ

答えて

関連する問題