app/models/poll/officer.rb
Specify a :dependent
option. (https://rails.rubystyle.guide#has_many-has_one-dependent-option) Open
Open
has_many :shifts
- Read upRead up
- Exclude checks
This cop looks for has_many
or has_one
associations that don't
specify a :dependent
option.
It doesn't register an offense if :through
option was specified.
Example:
# bad
class User < ActiveRecord::Base
has_many :comments
has_one :avatar
end
# good
class User < ActiveRecord::Base
has_many :comments, dependent: :restrict_with_exception
has_one :avatar, dependent: :destroy
has_many :patients, through: :appointments
end
Uniqueness validation should have a unique index on the database column. Open
Open
validates :user_id, presence: true, uniqueness: true
- Exclude checks
Specify a :dependent
option. (https://rails.rubystyle.guide#has_many-has_one-dependent-option) Open
Open
has_many :officer_assignments
- Read upRead up
- Exclude checks
This cop looks for has_many
or has_one
associations that don't
specify a :dependent
option.
It doesn't register an offense if :through
option was specified.
Example:
# bad
class User < ActiveRecord::Base
has_many :comments
has_one :avatar
end
# good
class User < ActiveRecord::Base
has_many :comments, dependent: :restrict_with_exception
has_one :avatar, dependent: :destroy
has_many :patients, through: :appointments
end
Specify a :dependent
option. (https://rails.rubystyle.guide#has_many-has_one-dependent-option) Open
Open
has_many :failed_census_calls, foreign_key: :poll_officer_id, inverse_of: :poll_officer
- Read upRead up
- Exclude checks
This cop looks for has_many
or has_one
associations that don't
specify a :dependent
option.
It doesn't register an offense if :through
option was specified.
Example:
# bad
class User < ActiveRecord::Base
has_many :comments
has_one :avatar
end
# good
class User < ActiveRecord::Base
has_many :comments, dependent: :restrict_with_exception
has_one :avatar, dependent: :destroy
has_many :patients, through: :appointments
end