Rails 4.2.6/MongoDbアプリケーションを作成しています。私はそれを含めへのルートの変更を行った、手動で「CALLUSER」と呼ばれる新しいアクションを作成:コントローラで作成された新しいアクションが動作していません
resources :companies do
member do
get 'calluser'
end
end
私は「すくいルート」コマンドを実行したとき、私はそれを見ることができます。
call_user_company GET /companies/:id/call_user(.:format) companies#call_user
しかし、
undefined method `calluser_company' for #<CompaniesController:0x007fdd893f3270>
01:
if @company.save format.html { redirect_to calluser_company(@company), notice: 'Company was successfully created.' } format.json { render action: 'show', status: :created, location: @company } else format.html { render action: 'new' } format.json { render json: @company.errors, status: :unprocessable_entity } end
私は、次のエラーが表示されます。私は、コントローラからリダイレクトする場合
これはなぜ起こっているのですか?私はどんな助けにも感謝します。
私は以前同様の問題を読みますが、彼らは私のために動作しませんでした:
Create a new action for existing controller
Route a form to new controller action in Ruby on Rails
実際のルートは、 "calluser_company"と書いたように、 'call_user_company'というレーキルートに表示されます。なぜ実際にアンダースコアが使われているのかわからない。 – Maxence
申し訳ありませんが、私は間違ったルートを貼り付けました:calluser_company GET /companies/:id/calluser(.:format)companies#calluser – user3538384
問題がどこから来たのか分かりません。あなたはサーバーを再起動しようとしましたか?ちなみに、JSONでは別のアクション(表示)にリダイレクトします – Maxence