-
Notifications
You must be signed in to change notification settings - Fork 14
No route matches [PATCH] "/students.4" #22
Comments
Relevant code: Controller:
View:
Index:
|
The "No route matching" part means that you're trying to submit the form to the wrong place or using the wrong method. You need to look at your routing table and see what it has that maps to students#update. No idea about the other error though. |
Ok well the other error was just my own fault (I had a plural instead of a non-plural for the path). However, I was able to get the edit working by realizing that my paths were set incorrectly, and I was trying to use edit_students_path instead of just students_path. So now, edit works, but it redirects me to a student with old data. Like, it acts really strange. If I only edit the image URL, it shows as not being edited. However, if I edit any of the other fields, it shows those changes, and sometimes the image URL changes. Overall, very erratic behavior (but when I go back to the list, the data is changed). Like, the data that is stored for the student isn't even displayed, its other random data. Anyone see this at all? |
So you're able to submit the form correctly, but the data is updated inconsistently? |
Right. It only happens if I view the page. Since the requirements called for navigating to the index, it works, but if I redirect back to the student entry, it doesn't work. |
I actually just got this same error, how did you "fix" it again? I don't seem to have any routes that map to PATCH... |
So, what I ended up doing was noticing that I didn't want to go to the edit_student_path, I just wanted to go to the student_path, because on the top of my edit form I had the following:
I was trying to send it to the wrong form. Does that help? |
I guess not... that seems to be what I have but I'm still getting that error... well, I'll keep working on it and I'll see if I can fix mine and then if it helps I'll let you know what I did. Maybe it'll fix your problem too. |
Ok. I will keep working through mine...sorry I couldn't be of more help, I changed so many lines of code when it worked I really couldn't remember what I changed to get there, I just remember taking a look at the routes and seeing what I needed to call to get the PATCH and the student#create. |
Well, I managed to fix it somehow but I'm not really sure how I did it... I just sort of changed some words then changed them again and then I thought I changed them back but then it just started working so... I can't really tell you what happened, sorry :( hope you figure it out! |
@awh112 were you able to figure this one out? Let me know if you're still having issues. |
I was, but in a roundabout way. As soon as I sent the user back to the index after the edit, instead of back to the individual student, it updated as expected. So, the issue was resolved, but I feel like if we were to route back to the student it would still behave erratically. I can close the issue since I am no longer have it, I just didn't know if anyone had run into the same problems. Thanks! |
Anyone run into this error before? I am trying to add editing functionality but it looks like it sends me to the wrong place. I had it wired up wrong before so "Submit" just created a new student with the changes, now I get this.
Any ideas?
The text was updated successfully, but these errors were encountered: