All field_set parameters unpermitted in PushType::NodesController#update

(Danny) #1

I am completely baffled as to why all my fields are not permitted in the NodesController. Any attempt to update a node results in all fields being set to nil.

Started PATCH "/push_type/nodes/87637922-a4c4-4644-835f-cc7f08dc97e6" for at 2017-01-29 22:33:41 +0800
Processing by PushType::NodesController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"GlBqQV+MhXDl/SdssBZxRc6QPG2mFInJyBc4AFw3n4aBd7WlzzcNXnBBL5SBAH76lGytN/57KvA523LZyAhNGg==", "video"=>{"title"=>"Children", "slug"=>"children-roberr-miles", "introduction"=>"fgh", "thumbnail_id"=>"57f9a575-3849-4b80-bd45-99de8cf0f4ac", "category_id"=>"95aa8136-f014-40f2-a82e-04abdb04116d", "video"=>"0", "piece"=>"Children (Dream Version)", "artist"=>"Robert Miles", "mp3"=>"", "body"=>"<p></p>", "tags"=>[""], "published_at(1i)"=>"2017", "published_at(2i)"=>"1", "published_at(3i)"=>"29", "published_at(4i)"=>"12", "published_at(5i)"=>"52", "published_to(1i)"=>"", "published_to(2i)"=>"", "published_to(3i)"=>"", "published_to(4i)"=>"", "published_to(5i)"=>"", "status"=>"published"}, "id"=>"87637922-a4c4-4644-835f-cc7f08dc97e6"}
  PushType::User Load (1.3ms)  SELECT  "push_type_users".* FROM "push_type_users" WHERE "push_type_users"."id" = $1  ORDER BY "push_type_users"."name" ASC LIMIT 1  [["id", "64dcfa4b-099e-4d34-8fd0-8d8cff301677"]]
  PushType::Node Load (0.8ms)  SELECT  "push_type_nodes".* FROM "push_type_nodes" WHERE "push_type_nodes"."id" = $1 LIMIT 1  [["id", "87637922-a4c4-4644-835f-cc7f08dc97e6"]]

This is where is says unpermitted paramters (continued):

Unpermitted parameters: introduction, thumbnail_id, category_id, video, piece, artist, mp3, body, tags
   (0.3ms)  BEGIN
  PushType::Node Exists (0.6ms)  SELECT  1 AS one FROM "push_type_nodes" WHERE ("push_type_nodes"."slug" = 'children-roberr-miles' AND "push_type_nodes"."id" != '87637922-a4c4-4644-835f-cc7f08dc97e6' AND "push_type_nodes"."parent_id" = 'e58261c9-8db9-4e3f-a9a1-0aacd37ff653') LIMIT 1
  SQL (2.0ms)  UPDATE "push_type_nodes" SET "field_store" = $1, "updater_id" = $2, "published_at" = $3, "updated_at" = $4 WHERE "push_type_nodes"."id" = $5  [["field_store", "{\"body\":null,\"piece\":null,\"video\":null,\"artist\":null,\"category_id\":null,\"thumbnail_id\":null}"], ["updater_id", "64dcfa4b-099e-4d34-8fd0-8d8cff301677"], ["published_at", "2017-01-29 12:52:00.000000"], ["updated_at", "2017-01-29 14:33:41.279331"], ["id", "87637922-a4c4-4644-835f-cc7f08dc97e6"]]
   (2.0ms)  COMMIT
Redirected to http://localhost:3000/push_type/nodes/e58261c9-8db9-4e3f-a9a1-0aacd37ff653/nodes
Completed 302 Found in 64ms (ActiveRecord: 6.9ms)

The update is successful as far as Rails is concerned. Recent changes include adding a different part of the site which uses a routing namespace as well as a Devise user model. Any idea what might be causion this rejection of paramters?

(Aaron Russell) #2

I think I read elsewhere that you’d upgraded to version 0.9.0. That was the first Rails 5 version and because of Rails’ changes to the strong parameters API, it broke compatibility with Rails 4.2. This was fixed again in version 0.9.1.


Anyway, that change you committed over the weekend will fix compatibility with Ruby 2.2 - so you should be good to use the latest version of PushType once I’ve packaged version 0.10.3.

(Danny) #3

Thanks, looking forward to that update.