Project

General

Profile

Actions

Defect #36584

closed

Error on creating custom fields using Ruby version 2.7.2

Added by C S about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Ruby support
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

Description

Original taken from here: https://www.redmine.org/boards/2/topics/66795?r=66803#message-66803
This ticket was created because of a request for help from the forum. I created it because Rub Version 2.7.2 was released in the User Guide... RedmineInstall
From: Maickel Neitzke

After logging in, I created a custom field and I can't edit it anymore.
Depending on the type of field created, different parts also fail redmine related to that type. When you exclude the field, everything goes back to normal.

Environment:
  Redmine version                4.2.3.stable
  Ruby version                   2.7.2-p137 (2020-10-01) [arm64-darwin21]
  Rails version                  5.2.6
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.32.0
  Filesystem                     
Redmine plugins:
  no plugin installed

Error Log:

Started GET "/custom_fields/3/edit" for 127.0.0.1 at 2022-02-06 23:02:12 -0300
Processing by CustomFieldsController#edit as HTML
  Parameters: {"id"=>"3"}
  Current user: admin (id=1)
  Rendering custom_fields/edit.html.erb within layouts/admin
  Rendered custom_fields/formats/_regexp.html.erb (1.2ms)
  Rendered custom_fields/formats/_string.html.erb (3.7ms)
  Rendered custom_fields/_form.html.erb (7.1ms)
  Rendered custom_fields/edit.html.erb within layouts/admin (7.9ms)
Completed 500 Internal Server Error in 17ms (ActiveRecord: 5.1ms)

ActionView::Template::Error (Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess):
    1: <%= render :partial => 'custom_fields/formats/regexp', :locals => {:f => f, :custom_field => custom_field} %>
    2: <p><%= f.check_box :text_formatting, {:label => :setting_text_formatting, :data => {:disables => '#custom_field_url_pattern'}}, 'full', '' %></p>
    3: <p><%= f.text_field(:default_value) %></p>
    4: <p><%= f.text_field :url_pattern, :size => 50, :label => :label_link_values_to %></p>

lib/redmine/views/labelled_form_builder.rb:36:in `check_box'
app/views/custom_fields/formats/_string.html.erb:2:in `_app_views_custom_fields_formats__string_html_erb___1692955113378240172_104420'
app/helpers/custom_fields_helper.rb:66:in `render_custom_field_format_partial'
app/views/custom_fields/_form.html.erb:19:in `_app_views_custom_fields__form_html_erb___1323675755188144023_104400'
app/views/custom_fields/edit.html.erb:4:in `block in _app_views_custom_fields_edit_html_erb__3236379970482473425_104380'
app/helpers/application_helper.rb:1459:in `labelled_form_for'
app/views/custom_fields/edit.html.erb:3:in `_app_views_custom_fields_edit_html_erb__3236379970482473425_104380'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

Problem solved.

I installed the 2.6.9 Ruby version and the issue not happened anymore.

Environment:
  Redmine version                4.2.3.stable
  Ruby version                   2.6.9-p207 (2021-11-24) [arm64-darwin21]
  Rails version                  5.2.6
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.32.0
  Filesystem                     
Redmine plugins:
  no plugin installed

Related issues

Is duplicate of Redmine - Defect #36226: Psych 4: Psych::DisallowedClass exception when unserializing a setting valueClosedGo MAEDA

Actions
Actions #1

Updated by Pavel Rosický about 2 years ago

this is related to the new version of psych gem, see #36226

the easiest way is to downgrade the gem or wait until there's a new Redmine release with Psych 4 support

Actions #2

Updated by Go MAEDA about 2 years ago

Pavel Rosický wrote:

this is related to the new version of psych gem, see https://www.redmine.org/issues/36226

I have just backported the change in #36226 to 4.2-stable and 4.1-stable branches.

Actions #3

Updated by C S about 2 years ago

  • Status changed from New to Resolved

Well then we are now waiting very excited for the release date :)

Actions #4

Updated by Go MAEDA about 2 years ago

  • Is duplicate of Defect #36226: Psych 4: Psych::DisallowedClass exception when unserializing a setting value added
Actions #5

Updated by Go MAEDA about 2 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Duplicate

Closing this issue as a duplicate of #36226.

Actions #6

Updated by Tom Filiaggi almost 2 years ago

I don't think this is a duplicate of #36226, as the error message is different (does not mention Psych at all). I get a similar error message in a local 4.2 instance (using ruby 2.7.2) and I have verified that I have the Psych gem fix:

Started GET "/my/account" for ::1 at 2022-04-26 13:56:21 -0600
Processing by MyController#account as HTML
  Current user: admin (id=4)
  Rendering my/account.html.erb within layouts/base
  Rendered my/account.html.erb within layouts/base (6.5ms)
Completed 500 Internal Server Error in 11ms (ActiveRecord: 2.6ms)

ActionView::Template::Error (Tried to load unspecified class: ActiveSupport::HashWithIndifferentAccess):
    43:   </p>
    44:   <% end -%>
    45: 
    46:   <% @user.custom_field_values.select(&:editable?).each do |value| %>
    47:     <p><%= custom_field_tag_with_label :user, value %></p>
    48:   <% end %>
    49:   <%= call_hook(:view_my_account, :user => @user, :form => f) %>

app/models/custom_field.rb:225:in `full_text_formatting?'
app/helpers/custom_fields_helper.rb:84:in `custom_field_tag'
app/helpers/custom_fields_helper.rb:120:in `custom_field_tag_with_label'
app/views/my/account.html.erb:46:in `block (2 levels) in _app_views_my_account_html_erb___3008421757190608950_90980'
app/views/my/account.html.erb:45:in `each'
app/views/my/account.html.erb:45:in `block in _app_views_my_account_html_erb___3008421757190608950_90980'
app/helpers/application_helper.rb:1459:in `labelled_form_for'
app/views/my/account.html.erb:14:in `_app_views_my_account_html_erb___3008421757190608950_90980'
This occurs without any plugins.
  1. Create Custom Field
  2. Attempt to go to "My Account" page.

What was it about this ticket that suggests it was the Psych gem error?

Actions #7

Updated by Tom Filiaggi almost 2 years ago

The proposed solution of reverting back to ruby v2.6.9 also worked for me.

Actions

Also available in: Atom PDF