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

Search for the Rails module in the root namespace #1894

Merged
merged 4 commits into from
Nov 3, 2023
Merged

Search for the Rails module in the root namespace #1894

merged 4 commits into from
Nov 3, 2023

Conversation

Zeneixe
Copy link
Contributor

@Zeneixe Zeneixe commented Nov 2, 2023

Fix for the issue described here: #1891

NoMethodError: undefined method `env' for MyProject::Rails:Module (NoMethodError)

    if Rails.env.development? || Rails.env.test?
            ^^^^
/home/circleci/project/vendor/bundle/ruby/3.2.0/gems/view_component-3.7.0/lib/view_component/base.rb:222:in `<class:Base>'

The issue started with version 3.6.0, the code above was introduced with this PR: #1841

What are you trying to accomplish?

Fix the issue

What approach did you choose and why?

By specifying the root namespace for Rails we avoid the ambiguity. It seems to be the simplest possible fix at hand

@Spone
Copy link
Collaborator

Spone commented Nov 2, 2023

Hi @Zeneixe thanks for the PR. Could you please add a CHANGELOG entry for this fix?

@Zeneixe
Copy link
Contributor Author

Zeneixe commented Nov 3, 2023

@Spone done

docs/CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Hans Lemuet <[email protected]>
Co-authored-by: Hans Lemuet <[email protected]>
@camertron camertron merged commit f9be01a into ViewComponent:main Nov 3, 2023
23 checks passed
claudiob pushed a commit to claudiob/view_component that referenced this pull request Dec 22, 2023
claudiob pushed a commit to claudiob/view_component that referenced this pull request Jan 3, 2024
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 this pull request may close these issues.

3 participants