lib/perus/server/models/script.rb in perus-0.1.2 vs lib/perus/server/models/script.rb in perus-0.1.3
- old
+ new
@@ -1,9 +1,10 @@
module Perus::Server
class Script < Sequel::Model
plugin :validation_helpers
one_to_many :script_commands, order: 'name asc'
+ one_to_many :actions
def code_name
name.gsub(' ', '_').camelize
end
@@ -21,9 +22,13 @@
if script_commands.empty?
0
else
script_commands.last.order
end
+ end
+
+ def can_delete?
+ actions_dataset.empty?
end
def validate
super
validates_presence :name