What happened just before the problem occurred? Or what problem could this idea solve?
As an Admin, I edited text in a Feature, then clicked Save. The page reloaded with a "This page does not exist" screen, see screenshot. I also tested clicking "Save" without editing, with the same result.
What did you expect to see that you didn't?
I expected to see my edits successfully saved.
https://publiclab.org/features/17211
https://publiclab.org/features/11796/
and for Jeff: https://publiclab.slack.com/archives/CV7KG8MFT/p1617198609007000
bhamster
liz
Thank you!
Noting some finding that may assist in solving this.
When we try to edit and save in local development environment, the route seems to throwing off an exception.
No route matches [POST] "/features/<id>"
It should be calling update
features controllers.
https://github.com/publiclab/plots2/blob/9e66b0f1a7c19733388d233308d2b090111bc627/app/views/features/edit.html.erb#L1
https://github.com/publiclab/plots2/blob/9e66b0f1a7c19733388d233308d2b090111bc627/app/controllers/features_controller.rb#L68 the update controller hasn't been updated for quite a while so not exactly sure what changed that is throwing off this exception now.
Wow very much appreciated! I got drawn into an adjacent bug 馃槄
I'll check the routes.rb file!
This line is 6 years old, so i doubt it's related!
I really don't see much in routes.rb...
I checked the the routes, there's no POST
method for features/:id
https://stackoverflow.com/questions/19501374/rails-4-routingerror-no-route-matches-post This might be related
indeed. i think it probably uses a more general matcher, or is implicit since it's a resource?
The broken feature was last edited 2 months ago
so i'm thinking there have only been a couple site republishes since then anyways! So strange!
I will look into if we had any changes in the node
model, since the stackoverflow solution seems to be pointing towards there.
Aha, i like your theory on the form_for
code, i think that's probably it. See this change: https://github.com/publiclab/plots2/pull/8923
I'll try reverting that change in local and checking the generated url of the form in HTML...
OK, current form shows <form action="/features/11796" accept-charset="UTF-8" method="post">
let me see after reverting this form_for change...
Hmm. Reverting :node
to @node
makes it <form class="edit_drupal_node" id="edit_drupal_node" action="/features/44" accept-charset="UTF-8" method="post">
looks pretty similar... let me inspect the whole form, maybe even try submitting it and inspecting the package sent...
-<%= form_for :node, :as => :drupal_node, :url => url do |f| %>
+<%= form_for @node, :as => :drupal_node, :url => url do |f| %>
This solved it :)
@node
was changed to :node
unknowingly i guess.
Hmm. Reverting
:node
to@node
makes it<form class="edit_drupal_node" id="edit_drupal_node" action="/features/44" accept-charset="UTF-8" method="post">
looks pretty similar... let me inspect the whole form, maybe even try submitting it and inspecting the package sent...
Ohh I missed this.
Agreed. I'm going to try triggering a validation error to see if the displayed messages still work, as that was the target of the fix.
Looks ok!
I guess maybe it was a mistaken or unrelated change?
I'll rush this into production but we should back it with an integration test. That could be a pretty good FTO!
馃帀
https://github.com/publiclab/plots2/commit/99e0157d58497fa17e59c59099e97d39d3965d17 and monitoring the tests before merging to stable and publishing!
Thank you so much, @daemon1024 !!!
Most helpful comment
Thank you so much, @daemon1024 !!!