Class: CategoryRisk

Inherits:
ApplicationRecord show all
Defined in:
app/models/category_risk.rb

Overview

This model manage the links from Category and Risk

Relation

Validations

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

#div

Instance Attribute Details

#category_idInteger

Returns reference id to Category.

Returns:

  • (Integer)

    reference id to Category



27
28
29
30
31
32
# File 'app/models/category_risk.rb', line 27

class CategoryRisk < ApplicationRecord
  belongs_to :category
  belongs_to :risk

  validates :category, uniqueness: { scope: :risk }
end

#created_atDatetime

Returns date when the record was created.

Returns:

  • (Datetime)

    date when the record was created



27
28
29
30
31
32
# File 'app/models/category_risk.rb', line 27

class CategoryRisk < ApplicationRecord
  belongs_to :category
  belongs_to :risk

  validates :category, uniqueness: { scope: :risk }
end

#idInteger

Returns is the unique identifier for CategoryRisk.

Returns:



27
28
29
30
31
32
# File 'app/models/category_risk.rb', line 27

class CategoryRisk < ApplicationRecord
  belongs_to :category
  belongs_to :risk

  validates :category, uniqueness: { scope: :risk }
end

#risk_idInteger

Returns reference id to Risk.

Returns:

  • (Integer)

    reference id to Risk



27
28
29
30
31
32
# File 'app/models/category_risk.rb', line 27

class CategoryRisk < ApplicationRecord
  belongs_to :category
  belongs_to :risk

  validates :category, uniqueness: { scope: :risk }
end

#updated_atDatetime

Returns date when the record was updated.

Returns:

  • (Datetime)

    date when the record was updated



27
28
29
30
31
32
# File 'app/models/category_risk.rb', line 27

class CategoryRisk < ApplicationRecord
  belongs_to :category
  belongs_to :risk

  validates :category, uniqueness: { scope: :risk }
end

Instance Method Details

#categoryObject

Returns instance of referenced Category.

Returns:

  • (Object)

    instance of referenced Category



27
28
29
30
31
32
# File 'app/models/category_risk.rb', line 27

class CategoryRisk < ApplicationRecord
  belongs_to :category
  belongs_to :risk

  validates :category, uniqueness: { scope: :risk }
end

#riskObject

Returns instance of referenced Risk.

Returns:

  • (Object)

    instance of referenced Risk



27
28
29
30
31
32
# File 'app/models/category_risk.rb', line 27

class CategoryRisk < ApplicationRecord
  belongs_to :category
  belongs_to :risk

  validates :category, uniqueness: { scope: :risk }
end