-
Notifications
You must be signed in to change notification settings - Fork 4
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
Accessing Rails.env in a model results in an error #16
Comments
Could you please share your model and example code causing this? |
|
Ok. So the issue is definitely with my refactoring: https://github.com/aws/aws-record-rails/blob/main/lib%2Faws-record-rails.rb#L17 Option 1 - Remove the rails module, just add a railtie, and put the version under that. This may be confusing and conflict with the aws-record gem version. Option 2 - Acknowledge this as breakage and customers roll forward small fixes. Using a root namespace is often necessary and preferential. Option 3 - Similar to 2, drop this gem if you don't use it. Requires upgrading to aws-sdk-rails 5. It is included by default in 4.2 to avoid breaking change in a minor version. |
@mullermp I am actually using aws-sdk-rails. Do I need to remove gem 'aws-record-rails' from my gemfile? I thought with v5 I HAVE to actively add it, like i also do with aws-activejob-sqs. |
No, with v5 all of the gems are modular. If you are not using sqs active job or the aws-record model/scaffold generators, you can remove them from your Gemfile. I think for your cases, you are using only aws-record and aws-actiondispatch-dynamodb. |
Please see aws/aws-sdk-rails#165 If there are any confusing bits I can clarify them in the post. As far as a fix for this, let me think about whether to remove the rails namespace or not.. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the bug
I can't use Rails.env (e.g. Rails.env.test?) anymore in Models, resulting in:
Only when I use
::Rails.env.test?
it works.Expected Behavior
Rails.env should have the expected behavior
Current Behavior
Rails.env is not available, only ::Rails.env
Reproduction Steps
Access Rails.env in any model.
Possible Solution
No response
Additional Information/Context
No response
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-record-rails latest
Environment details (Version of Ruby, OS environment)
Ruby 3.3.6 macos
The text was updated successfully, but these errors were encountered: