Class: ProjectMember

Inherits:
ApplicationRecord show all
Includes:
Housekeeping::Timestamps, Housekeeping::Users, Shared::IsData
Defined in:
app/models/project_member.rb

Overview

A ProjectMember is the link between projects and users.

Instance Attribute Summary (collapse)

Attributes included from Housekeeping::Users

#by

Method Summary

Methods included from Housekeeping::Timestamps

#data_breakdown_for_chartkick_recent

Methods included from Housekeeping::Users

#set_created_by_id, #set_updated_by_id

Methods included from ActiverecordUtilities

#trim_attributes

Instance Attribute Details

- (Boolean) is_project_administrator

Returns whether the user is a project administrator

Returns:

  • (Boolean)

    whether the user is a project administrator



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/project_member.rb', line 15

class ProjectMember < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::IsData

  belongs_to :project, inverse_of: :project_members
  belongs_to :user, inverse_of: :project_members

  validates :project, presence: true
  validates :user, presence: true
  validates_uniqueness_of :user_id, scope: [:project_id], message: 'is already a member of project'

end

- (Integer) project_id

the project ID

Returns:

  • (Integer)


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/project_member.rb', line 15

class ProjectMember < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::IsData

  belongs_to :project, inverse_of: :project_members
  belongs_to :user, inverse_of: :project_members

  validates :project, presence: true
  validates :user, presence: true
  validates_uniqueness_of :user_id, scope: [:project_id], message: 'is already a member of project'

end

- (Integer) user_id

Returns the user

Returns:

  • (Integer)

    the user



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/project_member.rb', line 15

class ProjectMember < ApplicationRecord
  include Housekeeping::Users
  include Housekeeping::Timestamps
  include Shared::IsData

  belongs_to :project, inverse_of: :project_members
  belongs_to :user, inverse_of: :project_members

  validates :project, presence: true
  validates :user, presence: true
  validates_uniqueness_of :user_id, scope: [:project_id], message: 'is already a member of project'

end