Less code

pull/246/head
Rick Carlino 2016-05-04 11:01:18 -05:00
parent 54f172c2f5
commit 2af0e6330c
1 changed files with 1 additions and 16 deletions

View File

@ -14,27 +14,12 @@ module Sequences
end
def validate
read_users_mind
add_error(:steps, :empty, "Can't be blank") if steps == []
raise Errors::Forbidden unless sequence.device.users.include?(user)
end
def execute
update_attributes(sequence, inputs.except(:user, :sequence, :_id))
end
def read_users_mind
case steps
when nil
# User doesn't want to touch the steps.
nil
when []
# User wants to empty the step list
# This is not legal, but we let it pass through for the sake of
# generating coherent, readable errors
add_error(:steps, :empty, "Can't be blank")
else
nil
end
end
end
end