diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/call_route.rb | 8 | ||||
-rw-r--r-- | app/models/route_element.rb | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/app/models/call_route.rb b/app/models/call_route.rb index 5d90901..1fe61e9 100644 --- a/app/models/call_route.rb +++ b/app/models/call_route.rb @@ -18,4 +18,12 @@ class CallRoute < ActiveRecord::Base def to_s name.to_s end + + def move_up? + return self.position.to_i > CallRoute.where(:routing_table => self.routing_table ).order(:position).first.position.to_i + end + + def move_down? + return self.position.to_i < CallRoute.where(:routing_table => self.routing_table ).order(:position).last.position.to_i + end end diff --git a/app/models/route_element.rb b/app/models/route_element.rb index 324a26d..94f0f84 100644 --- a/app/models/route_element.rb +++ b/app/models/route_element.rb @@ -16,4 +16,11 @@ class RouteElement < ActiveRecord::Base "#{pattern} => #{var_in} #{var_out}" end + def move_up? + #return self.position.to_i > RouteElement.where(:call_route_id => self.call_route_id ).order(:position).first.position.to_i + end + + def move_down? + #return self.position.to_i < RouteElement.where(:call_route_id => self.call_route_id ).order(:position).last.position.to_i + end end |