lib/steel_wheel/command.rb in steel_wheel-0.5.2 vs lib/steel_wheel/command.rb in steel_wheel-0.6.0
- old
+ new
@@ -1,18 +1,24 @@
+# frozen_string_literal: true
+
module SteelWheel
+ # Base class for commands
class Command
include Memery
include ActiveModel::Validations
def self.name
'SteelWheel::Command'
end
def http_status
- errors.keys.first
+ return :ok if errors.empty?
+ return errors.keys.first unless defined?(ActiveModel::Error)
+
+ errors.map(&:type).first
end
- def call
+ def call(*)
# NOOP
end
end
end