以下は私のコントローラのProjects#showメソッドです。NoMethodErrorを取得しているRuby on Rails
以下は、私のProjects#show view html.erbファイルです。
<%= react_component 'ProjectManage', { pm: @pm, supervisors: @supervisors, employees: @employees } %>
フロントエンド私が反応している以下の
@ProjectManage = React.createClass
getInitialState: ->
pm: @props.pm
render: ->
React.DOM.div
className: 'org-chart'
@props.pm.email
for supervisor in @props.supervisors
React.DOM.ul supervisor.email
for employee in @props.employees[supervisor]
React.DOM.li employee.email
私が取得エラーメッセージは次のとおりです。
はActiveRecordの中で500内部サーバーエラーを完了しました。
NoMethodError(ProjectsControllerの#ショーのための未定義のメソッド ` ':0x007fa195b59da0
がProjectsController番号によって2016年11月24日午前6時31分38秒-0800 処理で127.0.0.1のために、 "/プロジェクト/ 1" をGET開始HTMLとして表示する {"id" => "1"}ユーザーロード(0.1ms)SELECT "users"。* from "users" WHERE "users"。 "id" =?ORDER BY "users"プロジェクト ""どこから "プロジェクト" "どこから" "projects"。 "id" =?LIMIT 1 [["" id "ASC LIMIT 1 [[" id "、2]]
プロジェクトロード(0.1ms) 、1]]ユーザ負荷(0.2ms)SELECT "users"。* FROM "users" WHERE "users"。 "id" =?LIMIT 1 [["id"、1]]* "FROM" relation " WHERE(supervisor_id = 1)ユーザー負荷(0.1ms)SELECT" users "。* FROM WHERE(id = 1)完了500 17ms で内部サーバーエラー(ActiveRecordの:0.5msの)NoMethodError(未定義のメソッド '' #用):アプリ/コントローラ/ projects_controller.rb:11: `ショーで」
レンダリング /ホーム/ ferg /.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_source.erb (2.7ms)レンダリング /home /ferg/.rbenv/vers/2.3/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb(1.1ms)レンダリング /home/ferg/.gifs/action_dispatch /ミドルウェア/テンプレート/レスキュー/ _request_and_response.html.erb (2.0ms)レンダリング /rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb レスキュー/レイアウト(19.6ms)レンダリング /home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/_markup.html .erb (0.2ms)レンダリング /home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup .html.erb in layouts/inlined_string(0.2ms)レンダリング /home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates /_prompt_box_markup.html.erbin layouts/inlined_string(0.3ms)レンダリング /home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0 /lib/web_console/templates/style.css.erbレイアウト内の /inlined_string(0.4ms)レンダリング /home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web -console-2.3.0/lib/web_console/templates/console.js.erb レイアウト内/ javascript(22.3ms)レンダリング /home/ferg /rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb レイアウト内/ javascript(0.2ms)レンダリング (レイアウト/ javascriptの内/home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb 0.2ms)レンダリング /home/ferg/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (34.9ms)
エラースタックトレース全体を投稿すると、showメソッド – dnsh
でエラーが発生した行の位置を特定するのに役立ちます。それを私のPCにロードして、あなたに手に入れてください。 –
Aparently問題はである:@supervisors = User.all.where( "ID =?"、Relationship.all.where( "supervisor_id =?"、@ project.user_id).pluck(:supervisor_id)) –