Skip to content

Commit

Permalink
Modify example code to not contain offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
rrosenblum authored and bbatsov committed Jan 11, 2019
1 parent 2177c2b commit 8e38f13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 4 additions & 6 deletions lib/rubocop/cop/rails/inverse_of.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ module Rails
# # good
# class Blog < ApplicationRecord
# has_many(:posts,
# -> { order(published_at: :desc) },
# inverse_of: :blog
# )
# -> { order(published_at: :desc) },
# inverse_of: :blog)
# end
#
# class Post < ApplicationRecord
Expand All @@ -62,9 +61,8 @@ module Rails
# # When you don't want to use the inverse association.
# class Blog < ApplicationRecord
# has_many(:posts,
# -> { order(published_at: :desc) },
# inverse_of: false
# )
# -> { order(published_at: :desc) },
# inverse_of: false)
# end
#
# @example
Expand Down
10 changes: 4 additions & 6 deletions manual/cops_rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -923,9 +923,8 @@ end
# good
class Blog < ApplicationRecord
has_many(:posts,
-> { order(published_at: :desc) },
inverse_of: :blog
)
-> { order(published_at: :desc) },
inverse_of: :blog)
end

class Post < ApplicationRecord
Expand All @@ -947,9 +946,8 @@ end
# When you don't want to use the inverse association.
class Blog < ApplicationRecord
has_many(:posts,
-> { order(published_at: :desc) },
inverse_of: false
)
-> { order(published_at: :desc) },
inverse_of: false)
end
```
```ruby
Expand Down

0 comments on commit 8e38f13

Please sign in to comment.