Reputation: 2274
My lint program says this line is too long:
@abc = @def.model_name.where(id: @ghi.id).sum(:jkl) unless @ghi.blank?
How can I fix it?
Upvotes: 0
Views: 5322
Reputation: 4058
The solution is to make the line shorter.
unless @ghi.blank?
@abc = @def.model_name
.where(id: @ghi.id)
.sum(:jkl)
end
This would be the generally accepted way of shortening the lines without refactoring more widely.
Also, it's just a linter. Your code will still work if you don't do as it says, it'll just be less readable.
Upvotes: 2
Reputation: 2274
Took me a while but fixed it
@abc = @def.model_name.where(
id: @ghi.id).sum(:jkl) unless @ghi.blank?
Upvotes: 2