سؤال

I need an action to return an Array(it will be later processed by a middleware).

However, this always convert returned value to string:

def logs
  # logic here
  [1, 2, 3]
end

How to tell Espresso to return it as is?

هل كانت مفيدة؟

المحلول

Good question.

And there is a good answer :)

Use response.body setter:

def logs
  # logic here
  response.body = [1, 2, 3]
end
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top