Merge pull request #1545 from dPliakos/enable_rails_find_each
Enable rails/findEach Rubocop cop
This commit is contained in:
commit
f2c0367a74
3 changed files with 5 additions and 9 deletions
|
|
@ -196,6 +196,10 @@ Lint/DuplicatedKey:
|
||||||
Rails:
|
Rails:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
# Use `find_each` instead of `each`.
|
||||||
|
Rails/FindEach:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
# Avoid use of old-style attribute validation
|
# Avoid use of old-style attribute validation
|
||||||
Rails/Validation:
|
Rails/Validation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
|
||||||
|
|
@ -154,14 +154,6 @@ Rails/FindBy:
|
||||||
- 'app/models/ticket_purchase.rb'
|
- 'app/models/ticket_purchase.rb'
|
||||||
- 'app/models/user.rb'
|
- 'app/models/user.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: Include.
|
|
||||||
# Include: app/models/**/*.rb
|
|
||||||
Rails/FindEach:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/conference.rb'
|
|
||||||
|
|
||||||
# Offense count: 7
|
# Offense count: 7
|
||||||
# Configuration parameters: Include.
|
# Configuration parameters: Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,7 @@ class Conference < ActiveRecord::Base
|
||||||
def self.write_event_distribution_to_db
|
def self.write_event_distribution_to_db
|
||||||
week = DateTime.now.end_of_week
|
week = DateTime.now.end_of_week
|
||||||
|
|
||||||
Conference.where('end_date > ?', Date.today).each do |conference|
|
Conference.where('end_date > ?', Date.today).find_each do |conference|
|
||||||
result = {}
|
result = {}
|
||||||
Event.state_machine.states.each do |state|
|
Event.state_machine.states.each do |state|
|
||||||
count = conference.program.events.where('state = ?', state.name).count
|
count = conference.program.events.where('state = ?', state.name).count
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue