Skip to content

Condition Logic broken in upgraded Rails 7.2 system #666

@briri

Description

@briri

Experiencing multiple issues dealing with templates that use conditional logic (and plans based off of them).

Template sections cannot be expanded if they contain a question with conditional logic:

dmptool-1  | 00:32:25 web.1          | ActionView::Template::Error (You tried to define an enum named "action_type" on the model "Condition", but this will generate a instance method "remove?", which is already defined by another enum.):
dmptool-1  | 00:32:25 web.1          | 
dmptool-1  | 00:32:25 web.1          | Causes:
dmptool-1  | 00:32:25 web.1          | ArgumentError (You tried to define an enum named "action_type" on the model "Condition", but this will generate a instance method "remove?", which is already defined by another enum.)
dmptool-1  | 00:32:25 web.1          |     3:   <%= render partial: "org_admin/questions/show",
dmptool-1  | 00:32:25 web.1          |     4:     locals: local_assigns.merge({
dmptool-1  | 00:32:25 web.1          |     5:       question: question,
dmptool-1  | 00:32:25 web.1          |     6:       conditions: question.conditions.order(:number)
dmptool-1  | 00:32:25 web.1          |     7:     }) %>
dmptool-1  | 00:32:25 web.1          |     8: </div>
dmptool-1  | 00:32:25 web.1          |   
dmptool-1  | 00:32:25 web.1          | app/models/condition.rb:29:in `<class:Condition>'

Cannot add new conditional logic. The logs report:

dmptool-1  | 00:37:16 web.1          | NoMethodError (undefined method `each' for nil:NilClass):
dmptool-1  | 00:37:16 web.1          |   
dmptool-1  | 00:37:16 web.1          | app/controllers/org_admin/questions_controller.rb:236:in `sanitize_hash'
dmptool-1  | 00:37:16 web.1          | app/controllers/org_admin/questions_controller.rb:169:in `update'

Which is due to the way the parameters are passed into the controller. They do not use the Rails standard _attributes suffix but instead use a custom approach that involves the app/helpers/condition_helper.rb

The data is also serialized as TEXT delimited by newline characters when it should really be stored as JSON arrays.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions