command_builder = rom.command # no relation given, so get builder nested_command = command_builder.create(user: :users) do |user| user.create(:books) end # equivalent: nested_command = rom.command({user: :users}, [:create, [:books, [:create]]]) # equivalent user_create = rom.command(:users)[:create] books_create = rom.comand(:books)[:create] nested_command = -> input { user_create.call(input[:user]).combine( books_create.call(input[:user][:books]) ) } # and books_create command is built to take (books, user) # and gets partially applied with :books, so on combine # it receives output of user_create command, which will be a user