consul/consul

View on GitHub
app/models/poll.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class Poll has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

class Poll < ApplicationRecord
  require_dependency "poll/answer"

  include Imageable
  acts_as_paranoid column: :hidden_at
Severity: Minor
Found in app/models/poll.rb - About 4 hrs to fix

    Specify a :dependent option. (https://rails.rubystyle.guide#has_many-has_one-dependent-option)
    Open

      has_many :booth_assignments, class_name: "Poll::BoothAssignment"
    Severity: Minor
    Found in app/models/poll.rb by rubocop

    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

      has_many :geozones_polls
    Severity: Minor
    Found in app/models/poll.rb by rubocop

    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

      has_many :voters
    Severity: Minor
    Found in app/models/poll.rb by rubocop

    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

      has_many :comments, as: :commentable, inverse_of: :commentable
    Severity: Minor
    Found in app/models/poll.rb by rubocop

    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

      has_many :ballot_sheets
    Severity: Minor
    Found in app/models/poll.rb by rubocop

    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

    There are no issues that match your filters.

    Category
    Status