Skip to content

OpenStruct no longer supported by json #695

@TanookiMario

Description

@TanookiMario

Bug Report

Describe the bug

Rubocop v1.63.0 updates json to v2.7.2. json v2.7.2 makes OpenStruct optional. StimulusReflex relies on OpenStruct in both the Dataset and the Element models. Attempting to run rails, ie a rails console, results in the error

/.rvm/gems/ruby-3.2.2/gems/stimulus_reflex-3.5.0.rc4/lib/stimulus_reflex/dataset.rb:5:in `<main>': uninitialized constant OpenStruct (NameError)

To Reproduce

using rubocop v1.63.0 or above, attempt to run rails console or start a rails server

Expected behavior

the rails action can be performed without an error that causes it to exit

it seems a quick fix would be to explicitly requiring ostruct, like this suggestion

a longer term fix would be to stop using OpenStruct altogether as its use is discouraged

Versions

StimulusReflex

  • Gem: 3.5.0.rc4
  • Node package: yarn 1.22.19

External tools

  • Ruby: 3.2.2p53
  • Rails: 7.0.8.1
  • Node: 18.19.0
  • Rubocop: 1.63.0
  • Json: 2.7.2

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