Quantcast
Viewing latest article 1
Browse Latest Browse All 10

Calling a macro on a depply nested rule

@DawidJanczak wrote:

Hello,

I was wondering if it’s possible to apply a macro to each element of an array that is itself nested in an array. Consider the following structure

optional(:rooms).array(:hash) do
  required(:guests).array(:hash, GuestSchema)
end

I’d like to apply a pre-existing macro to each guest in such a structure. If rooms wasn’t array, but a hash I could just do rule(rooms: :guests).each(:macro), but in case of array that doesn’t seem to work. I’m also unable to call a macro from within a rule(:rooms).each block.

Read full topic


Viewing latest article 1
Browse Latest Browse All 10

Trending Articles