mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-29 20:26:11 +01:00
Code style fixes
This commit is contained in:
parent
c6bbc67dab
commit
d8acf60049
72 changed files with 458 additions and 594 deletions
|
|
@ -1,17 +1,13 @@
|
|||
class Dependency < ApplicationRecord
|
||||
|
||||
# touch to make sure todo caches for predecessor and successor are invalidated
|
||||
|
||||
belongs_to :predecessor, :foreign_key => 'predecessor_id', :class_name => 'Todo', :touch => true
|
||||
belongs_to :successor, :foreign_key => 'successor_id', :class_name => 'Todo', :touch => true
|
||||
belongs_to :successor, :foreign_key => 'successor_id', :class_name => 'Todo', :touch => true
|
||||
|
||||
validate :check_circular_dependencies
|
||||
|
||||
def check_circular_dependencies
|
||||
unless predecessor.nil? or successor.nil?
|
||||
unless predecessor.nil? || successor.nil?
|
||||
errors.add("Depends on:", "Adding '#{successor.specification}' would create a circular dependency") if successor.is_successor?(predecessor)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue