前提・実現したいこと
添付画像の赤丸で示した部分を押すと、編集できるのですがこれを以下のパターンでやれるようにしたいです。
一般ユーザが操作:自分のデータを編集可能
管理者ユーザが操作:自分の含め全ユーザのデータを編集可能
現在、
一般ユーザと管理者ユーザで自分のデータを編集はうまくいくのですが
管理者ユーザで一般ユーザのデータを更新がうまくいかず
編集画面でデータを入力して、更新するボタンを押すとエラーになってしまいます。
遷移先などの誤りだとは思うのですが、何か解決策などわかる方はいらっしゃいますでしょうか?
発生している問題・エラーメッセージ
Started PATCH "/tasks/2" for ::1 at 2019-05-20 14:28:04 +0900 Processing by TasksController#update as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"+4AI6wfJm6g0NDaBG1gDA5SZV/pO1SjdxxBjjFBZLi3ssTEaFdQ+7NS7ty7+4R14mChqAMWoSKYLbMe40rJEUg==", "task"=>{"title"=>"test_user", "updated_day"=>"2019-05-20", "minutes"=>"60", "complete"=>"1", "category_id"=>"3"}, "commit"=>"更新する", "id"=>"2"} User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]] Task Load (0.1ms) SELECT "tasks".* FROM "tasks" WHERE "tasks"."user_id" = ? AND "tasks"."id" = ? LIMIT ? [["user_id", 1], ["id", 2], ["LIMIT", 1]] Redirected to http://localhost:3000/tasks Filter chain halted as :set_task rendered or redirected Completed 302 Found in 3ms (ActiveRecord: 0.2ms) Started GET "/tasks" for ::1 at 2019-05-20 14:28:04 +0900 AbstractController::ActionNotFound - The action 'index' could not be found for TasksController: Started POST "/__better_errors/be6ebb563f862943/variables" for ::1 at 2019-05-20 14:28:05 +0900
該当のソースコード
https://github.com/sugar821/20190403task/tree/mail
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。