Class: Board

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

Constant Summary collapse

RECENT_BOARDS_SIZE =
4

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.to_typeObject


43
44
45
# File 'app/models/board.rb', line 43

def self.to_type
  name.demodulize
end

Instance Method Details

#disabled_for?(current_user) ⇒ Boolean

Returns:

  • (Boolean)

51
52
53
54
55
# File 'app/models/board.rb', line 51

def disabled_for?(current_user)
  namespace = group_board? ? resource_parent.root_ancestor : resource_parent.root_namespace

  namespace.issue_repositioning_disabled? || !Ability.allowed?(current_user, :create_non_backlog_issues, self)
end

#group_board?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'app/models/board.rb', line 31

def group_board?
  group_id.present?
end

#project_board?Boolean

Returns:

  • (Boolean)

35
36
37
# File 'app/models/board.rb', line 35

def project_board?
  project_id.present?
end

#project_needed?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'app/models/board.rb', line 23

def project_needed?
  !group
end

#resource_parentObject


27
28
29
# File 'app/models/board.rb', line 27

def resource_parent
  @resource_parent ||= group || project
end

#scoped?Boolean

Returns:

  • (Boolean)

39
40
41
# File 'app/models/board.rb', line 39

def scoped?
  false
end

#to_typeObject


47
48
49
# File 'app/models/board.rb', line 47

def to_type
  self.class.to_type
end