Module: Roqua::Responders::ActiveInteractionAwareResponder

Defined in:
lib/roqua/responders/active_interaction_aware_responder.rb

Instance Method Summary collapse

Instance Method Details

#json_resource_errorsObject



16
17
18
19
20
21
22
# File 'lib/roqua/responders/active_interaction_aware_responder.rb', line 16

def json_resource_errors
  if !resource.is_a?(ActiveInteraction::Base) || resource.errors.empty?
    super
  else
    {:errors => resource.errors.as_json}
  end
end

#to_formatObject



6
7
8
9
10
11
12
13
14
# File 'lib/roqua/responders/active_interaction_aware_responder.rb', line 6

def to_format
  if resource.is_a?(ActiveInteraction::Base)
    if resource.errors.empty?
      @resource = resource.result
      @resources[-1] = resource
    end
  end
  super
end