Project

General

Profile

Bug #15718

Hashes defined in matchers do not save properly after the first time

Added by Gerard van Dijnsen over 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Parameters
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

When opening a class that contains a matcher that has a hash in a value field, the class can not be properly submitted. The hash is changed from json format into a normal ruby hash (valid as far as I can see). Saving of the class then fails with a 'JSON::ParserError: 795: unexpected token' error in the production.log.


Related issues

Related to Foreman - Feature #13244: Upgrade Ruby on Rails to 4.2Closed2016-01-15

Associated revisions

Revision c1903e2b (diff)
Added by Tomer Brisker over 4 years ago

Fixes #15718 - Correctly display hash parameters

Lookup values should dispaly the value before type cast for hash type
keys. Rails 4.2.6 introduced a change to the form helpers that only used
the value before type cast for user-provided input, so we need to
specify the correct value for the field instead of relying on the rails
helper to do it.

Revision db1d54cd (diff)
Added by Tomer Brisker over 4 years ago

Fixes #15718 - Correctly display hash parameters

Lookup values should dispaly the value before type cast for hash type
keys. Rails 4.2.6 introduced a change to the form helpers that only used
the value before type cast for user-provided input, so we need to
specify the correct value for the field instead of relying on the rails
helper to do it.

(cherry picked from commit c1903e2ba979c2811c00788165f2592fbecaef8d)

History

#1 Updated by Dominic Cleal over 4 years ago

  • Category set to Parameters
  • Legacy Backlogs Release (now unused) set to 161

Confirmed, this is a regression in 1.12.0. Rails now only calls value_before_type_cast (which contains the user YAML/JSON input) when rendering the tag if "value_came_from_user?" returns true too: https://github.com/rails/rails/commit/3e74db6

This causes Rails to use #value to render the tag which contains the Ruby hash.

#2 Updated by Dominic Cleal over 4 years ago

#3 Updated by Tomer Brisker over 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Tomer Brisker

#4 Updated by The Foreman Bot over 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3658 added

#5 Updated by Anonymous over 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF