Class: ProjectMember
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ProjectMember
- Defined in:
- app/models/project_member.rb
Overview
A ProjectMember is the link between projects and users.
Instance Attribute Summary collapse
-
#is_project_administrator ⇒ Boolean
Whether the user is a project administrator.
-
#project_id ⇒ Integer
the project ID.
-
#user_id ⇒ Integer
The user.
Attributes included from Housekeeping::Users
Instance Method Summary collapse
- #clipboard_slots ⇒ Object protected
Methods included from Shared::IsData
#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar
Methods included from Housekeeping::Users
#set_created_by_id, #set_updated_by_id
Methods inherited from ApplicationRecord
Instance Attribute Details
#is_project_administrator ⇒ Boolean
Returns whether the user is a project administrator.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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' validate :clipboard_slots protected def clipboard_slots errors.add(:clipboard, 'slot is not legal') if clipboard.keys - %w{1 2 3 4 5} != [] end end |
#project_id ⇒ Integer
the project ID
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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' validate :clipboard_slots protected def clipboard_slots errors.add(:clipboard, 'slot is not legal') if clipboard.keys - %w{1 2 3 4 5} != [] end end |
#user_id ⇒ Integer
Returns the user.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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' validate :clipboard_slots protected def clipboard_slots errors.add(:clipboard, 'slot is not legal') if clipboard.keys - %w{1 2 3 4 5} != [] end end |
Instance Method Details
#clipboard_slots ⇒ Object (protected)
30 31 32 |
# File 'app/models/project_member.rb', line 30 def clipboard_slots errors.add(:clipboard, 'slot is not legal') if clipboard.keys - %w{1 2 3 4 5} != [] end |