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

fix(Generator): Dynamically set ActiveRecord class #11

Merged
merged 2 commits into from
Jul 31, 2018
Merged

fix(Generator): Dynamically set ActiveRecord class #11

merged 2 commits into from
Jul 31, 2018

Conversation

gnfisher
Copy link
Contributor

Addresses #10.

Rails 5 models inherit from ApplicationRecord rather than ActiveRecord::Base as
in previous versions. This checks the Rails::VERSION::MAJOR and sets the class
accordingly in the generator.

Tested it manually, couldn't think of an obvious way to write spec coverage.
Happy to take direction and add some tests if you have ideas.

Rails 5 models inherit from ApplicationRecord rather than ActiveRecord::Base as
in previous versions. This checks the Rails::VERSION::MAJOR and sets the class
accordingly in the generator.

Tested it manually, couldn't think of an obvious way to write spec coverage.
Happy to take direction and add some tests if you have ideas.
Copy link

@monkeyci monkeyci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

.rubocop.yml: Style/AccessModifierIndentation has the wrong namespace - shoul...
.rubocop.yml: Style/AccessModifierIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/AlignHash has the wrong namespace - should be Layout
.rubocop.yml: Style/AlignParameters has the wrong namespace - should be Layout
.rubocop.yml: Style/CaseIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLineBetweenDefs has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundBlockBody has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundClassBody has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundModuleBody has the wrong namespace - should be Layout
.rubocop.yml: Style/FirstParameterIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentationWidth has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentHash has the wrong namespace - should be Layout
.rubocop.yml: Style/MultilineOperationIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundBlockParameters has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundEqualsInParameterDefault has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeBlockBraces has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideBlockBraces has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideHashLiteralBraces has the wrong namespace - should be Layout
.rubocop.yml: Style/TrailingBlankLines has the wrong namespace - should be Layout
.rubocop.yml: Style/ExtraSpacing has the wrong namespace - should be Layout
.rubocop.yml: Style/AlignArray has the wrong namespace - should be Layout
.rubocop.yml: Style/BlockEndNewline has the wrong namespace - should be Layout
.rubocop.yml: Style/CommentIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/ElseAlignment has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLines has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundAccessModifier has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundMethodBody has the wrong namespace - should be Layout
.rubocop.yml: Style/EndOfLine has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentationConsistency has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentArray has the wrong namespace - should be Layout
.rubocop.yml: Style/LeadingCommentSpace has the wrong namespace - should be Layout
.rubocop.yml: Style/MultilineBlockLayout has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterColon has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterComma has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundKeyword has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterMethodName has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterNot has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterSemicolon has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeComma has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeComment has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeFirstArg has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeSemicolon has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundOperators has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideBrackets has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideParens has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideRangeLiteral has the wrong namespace - should be Layout
.rubocop.yml: Style/Tab has the wrong namespace - should be Layout
.rubocop.yml: Style/TrailingWhitespace has the wrong namespace - should be Layout
.rubocop.yml: Lint/Eval has the wrong namespace - should be Security
Error: The `Style/MethodCallParentheses` cop has been renamed to `Style/MethodCallWithoutArgsParentheses`.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter IndentWhenRelativeTo (for Layout/CaseIndentation) found in .rubocop.yml
`IndentWhenRelativeTo` has been renamed to `EnforcedStyle`
obsolete parameter AlignWith (for Lint/EndAlignment) found in .rubocop.yml
`AlignWith` has been renamed to `EnforcedStyleAlignWith`
obsolete parameter AlignWith (for Lint/DefEndAlignment) found in .rubocop.yml

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.96% when pulling e97f660 on gnfisher:observer-ar-class into 01e032e on platanus:master.

@gnfisher gnfisher closed this Oct 25, 2017
@gnfisher gnfisher deleted the observer-ar-class branch October 25, 2017 00:10
@gnfisher gnfisher restored the observer-ar-class branch October 25, 2017 00:59
Rails 5 models inherit from ApplicationRecord rather than ActiveRecord::Base as
in previous versions. This checks the Rails::VERSION::MAJOR and sets the class
accordingly in the generator.

Tested it manually, couldn't think of an obvious way to write spec coverage.
Happy to take direction and add some tests if you have ideas.
@gnfisher gnfisher reopened this Oct 25, 2017
Copy link

@monkeyci monkeyci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

.rubocop.yml: Style/AccessModifierIndentation has the wrong namespace - shoul...
.rubocop.yml: Style/AccessModifierIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/AlignHash has the wrong namespace - should be Layout
.rubocop.yml: Style/AlignParameters has the wrong namespace - should be Layout
.rubocop.yml: Style/CaseIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/DotPosition has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLineBetweenDefs has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundBlockBody has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundClassBody has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundModuleBody has the wrong namespace - should be Layout
.rubocop.yml: Style/FirstParameterIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentationWidth has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentHash has the wrong namespace - should be Layout
.rubocop.yml: Style/MultilineOperationIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundBlockParameters has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundEqualsInParameterDefault has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeBlockBraces has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideBlockBraces has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideHashLiteralBraces has the wrong namespace - should be Layout
.rubocop.yml: Style/TrailingBlankLines has the wrong namespace - should be Layout
.rubocop.yml: Style/ExtraSpacing has the wrong namespace - should be Layout
.rubocop.yml: Style/AlignArray has the wrong namespace - should be Layout
.rubocop.yml: Style/BlockEndNewline has the wrong namespace - should be Layout
.rubocop.yml: Style/CommentIndentation has the wrong namespace - should be Layout
.rubocop.yml: Style/ElseAlignment has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLines has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundAccessModifier has the wrong namespace - should be Layout
.rubocop.yml: Style/EmptyLinesAroundMethodBody has the wrong namespace - should be Layout
.rubocop.yml: Style/EndOfLine has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentationConsistency has the wrong namespace - should be Layout
.rubocop.yml: Style/IndentArray has the wrong namespace - should be Layout
.rubocop.yml: Style/LeadingCommentSpace has the wrong namespace - should be Layout
.rubocop.yml: Style/MultilineBlockLayout has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterColon has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterComma has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundKeyword has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterMethodName has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterNot has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAfterSemicolon has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeComma has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeComment has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeFirstArg has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceBeforeSemicolon has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceAroundOperators has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideBrackets has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideParens has the wrong namespace - should be Layout
.rubocop.yml: Style/SpaceInsideRangeLiteral has the wrong namespace - should be Layout
.rubocop.yml: Style/Tab has the wrong namespace - should be Layout
.rubocop.yml: Style/TrailingWhitespace has the wrong namespace - should be Layout
.rubocop.yml: Lint/Eval has the wrong namespace - should be Security
Error: The `Style/MethodCallParentheses` cop has been renamed to `Style/MethodCallWithoutArgsParentheses`.
(obsolete configuration found in .rubocop.yml, please update it)
obsolete parameter IndentWhenRelativeTo (for Layout/CaseIndentation) found in .rubocop.yml
`IndentWhenRelativeTo` has been renamed to `EnforcedStyle`
obsolete parameter AlignWith (for Lint/EndAlignment) found in .rubocop.yml
`AlignWith` has been renamed to `EnforcedStyleAlignWith`
obsolete parameter AlignWith (for Lint/DefEndAlignment) found in .rubocop.yml

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.96% when pulling f5745a0 on gnfisher:observer-ar-class into 01e032e on platanus:master.

@ldlsegovia ldlsegovia merged commit b5822a2 into platanus:master Jul 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants