Conversation
josemigallas
approved these changes
Jun 28, 2023
akostadinov
reviewed
Jun 29, 2023
|
|
||
| def self.for_model(model) | ||
| new(model: model, tenant: model.try!(:tenant)) | ||
| new(model: model, tenant: model&.tenant) |
Contributor
There was a problem hiding this comment.
@mayorova , this is not the same. try! should ignore any call errors while &.tenant will raise if model is not nil and #tenant method does not exist.
Contributor
Author
There was a problem hiding this comment.
@akostadinov I've checked this, and what you're saying is true for .try, on the other hand .try! does throw a NoMethodError, so its behavior is identical to &.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I added RuboCop gem to development and test environments.
.rubocop.ymlfile was already there, but the gem was not in the Gemfile.Also, the config was very outdated, so I updated the Cop names.
The 1st commit just makes the changes in the config (renaming obsolete ones, reordering according to the new namespaces etc.), but keeping them the same.
The 2nd commit cleans up the configs, removing all the cops that had
Enabled: false, as it's redundant, givenAllCops:DisabledByDefault: truesetting. The rubocop output is the same for before and after the 2nd commit.I also updated the
.codeclimate.ymlfile, it was outdated too, so it was using some old Ruby. It's up-to-date now.