Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenStruct no longer supported by json #695

Closed
TanookiMario opened this issue Apr 11, 2024 · 1 comment · Fixed by #697
Closed

OpenStruct no longer supported by json #695

TanookiMario opened this issue Apr 11, 2024 · 1 comment · Fixed by #697

Comments

@TanookiMario
Copy link

TanookiMario commented Apr 11, 2024

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
@marcoroth
Copy link
Member

Thanks for reporting @TanookiMario, I put up #697 to address this!

marcoroth added a commit that referenced this issue Apr 26, 2024
…nt` (#697)

Rubocop v1.63.0 updates json v2.7.2. StimulusReflex relies on OpenStruct in both the
Dataset and the Element models. Attempting to run rails, ie a rails console, results in the error. This pull requets fixes this by explicitly requiring `ostruct`.

We should think about migrating off of `OpenStruct`, but this PR should make it work for now as a work-around.

Fixes #695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants