Skip to content

Commit 67aeaa4

Browse files
rrosenblumkoic
authored andcommitted
Modify example code to not contain offenses
1 parent a54c273 commit 67aeaa4

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

lib/rubocop/cop/rails/inverse_of.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ module Rails
3838
# # good
3939
# class Blog < ApplicationRecord
4040
# has_many(:posts,
41-
# -> { order(published_at: :desc) },
42-
# inverse_of: :blog
43-
# )
41+
# -> { order(published_at: :desc) },
42+
# inverse_of: :blog)
4443
# end
4544
#
4645
# class Post < ApplicationRecord
@@ -62,9 +61,8 @@ module Rails
6261
# # When you don't want to use the inverse association.
6362
# class Blog < ApplicationRecord
6463
# has_many(:posts,
65-
# -> { order(published_at: :desc) },
66-
# inverse_of: false
67-
# )
64+
# -> { order(published_at: :desc) },
65+
# inverse_of: false)
6866
# end
6967
#
7068
# @example

manual/cops_rails.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -959,9 +959,8 @@ end
959959
# good
960960
class Blog < ApplicationRecord
961961
has_many(:posts,
962-
-> { order(published_at: :desc) },
963-
inverse_of: :blog
964-
)
962+
-> { order(published_at: :desc) },
963+
inverse_of: :blog)
965964
end
966965

967966
class Post < ApplicationRecord
@@ -983,9 +982,8 @@ end
983982
# When you don't want to use the inverse association.
984983
class Blog < ApplicationRecord
985984
has_many(:posts,
986-
-> { order(published_at: :desc) },
987-
inverse_of: false
988-
)
985+
-> { order(published_at: :desc) },
986+
inverse_of: false)
989987
end
990988
```
991989
```ruby

0 commit comments

Comments
 (0)