Plots2: "Save" not working on /features

Created on 1 Apr 2021  路  23Comments  路  Source: publiclab/plots2

Please describe the problem (or idea)

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.

Screen Shot 2021-04-01 at 10 08 36 AM

What did you expect to see that you didn't?
I expected to see my edits successfully saved.

Please show us where to look

https://publiclab.org/features/17211
https://publiclab.org/features/11796/
and for Jeff: https://publiclab.slack.com/archives/CV7KG8MFT/p1617198609007000

What's your PublicLab.org username?

bhamster
liz

Thank you!

bug help wanted

Most helpful comment

Thank you so much, @daemon1024 !!!

All 23 comments

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!

I really don't see much in routes.rb...

I checked the the routes, there's no POST method for features/:id

indeed. i think it probably uses a more general matcher, or is implicit since it's a resource?

https://github.com/publiclab/plots2/blob/9e66b0f1a7c19733388d233308d2b090111bc627/config/routes.rb#L23

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!

image

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 !!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keshavsethi picture keshavsethi  路  3Comments

noi5e picture noi5e  路  3Comments

first-timers[bot] picture first-timers[bot]  路  3Comments

shapironick picture shapironick  路  3Comments

jywarren picture jywarren  路  3Comments